Skip to content

Instantly share code, notes, and snippets.

@JSeam2
Created March 19, 2019 15:09
Show Gist options
  • Save JSeam2/4688feb9480edb9182ccde3fe33fa9de to your computer and use it in GitHub Desktop.
Save JSeam2/4688feb9480edb9182ccde3fe33fa9de to your computer and use it in GitHub Desktop.
Simple script to crop all files in the current folder
import PIL
from PIL import Image
import os
for x in os.listdir("./"):
try:
img = Image.open(x)
w, h = img.size
new_img = img.crop((100, 100, w-200, h-30))
new_img.save(x)
except:
continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment