Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions Python Projects/Cursed photo creater/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# put all the photo in "phototouse" folder run the script . Done your photo will be in "photoout" folder

from PIL import Image, ImageEnhance, ImageOps
import os

path = r"phototouse"
out = r"photoout"

factor = 2
brightness = 1.5

def edit_photo(filepath):
editedimg = Image.open(filepath)
editedimg = editedimg.convert("L")
editedimg = ImageEnhance.Contrast(editedimg).enhance(factor)
editedimg = ImageEnhance.Brightness(editedimg).enhance(brightness)
editedimg = ImageOps.expand(editedimg, border=20, fill=10)
return editedimg

for filename in os.listdir(path):
#!Get photo path
filepath = (f"{path}\{filename}")
print(filepath)

#!edit the photo
editPic = edit_photo(filepath)

#!Save the photo
editPic.save(f"{out}\{os.path.splitext(filename)[0]}_edited.jpg")

print("DONE ✅")
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.