imagehost/ih/images.py
2017-10-10 14:37:46 +03:00

13 lines
298 B
Python

from PIL import Image
def resize_image(fh, img_prop):
im = Image.open(fh)
# size = 100, 100
im.thumbnail(img_prop['size'])
print img_prop['size']
# im.thumbnail(size)
thumb_name = img_prop['dest'] + '/thumb_' + img_prop['name']
im.save(thumb_name)
return thumb_name