Last active
February 12, 2016 23:19
-
-
Save rezkam/0fa5e148b02e91f1114d to your computer and use it in GitHub Desktop.
Pillow Crop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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