Created
May 30, 2017 22:57
-
-
Save thebostik/80af0b50e789327cd76f043b171184cd to your computer and use it in GitHub Desktop.
Photo Upload Starting Point
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
# do a typical thumbnail, preserving aspect ratio | |
new_photo = photo.copy() | |
new_photo.thumbnail( | |
(width, height), | |
resample=PIL.Image.ANTIALIAS, | |
) | |
thumbfile = cStringIO.StringIO() | |
save_args = {'format': format} | |
if format == 'JPEG': | |
save_args['quality'] = 85 | |
new_photo.save(thumbfile, **save_args) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment