imagehost/ih/images.py

13 lines
301 B
Python
Raw Normal View History

2017-10-10 14:37:46 +03:00
from PIL import Image
def resize_image(fh, img_prop):
im = Image.open(fh)
2017-10-10 14:49:33 +03:00
# size = 100, 100
2017-10-10 14:37:46 +03:00
im.thumbnail(img_prop['size'])
2017-10-10 14:49:33 +03:00
print(img_prop['size'])
# im.thumbnail(size)
2017-10-10 14:37:46 +03:00
thumb_name = img_prop['dest'] + '/thumb_' + img_prop['name']
im.save(thumb_name)
return thumb_name