Skip to content

Instantly share code, notes, and snippets.

@rezkam
Last active February 12, 2016 23:19
Show Gist options
  • Save rezkam/0fa5e148b02e91f1114d to your computer and use it in GitHub Desktop.
Save rezkam/0fa5e148b02e91f1114d to your computer and use it in GitHub Desktop.
Pillow Crop
from PIL import Image
img = Image.open("image_name.jpg")
if img.size[0] == 800:
new_size = (0, 0 , img.size[0] , img.size[1] - 24)
else:
new_size = (0, 0 , img.size[0] , img.size[1] - 12)
new_image = img.crop(new_size)
new_image.save("new_size_image.jpg")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment