Last active
December 31, 2015 11:49
-
-
Save mikeyakymenko/7982301 to your computer and use it in GitHub Desktop.
Python thumbs
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, ImageOps | |
| import urllib2 as urllib | |
| import io | |
| fd = urllib.urlopen("http://a/b/c") | |
| image_file = io.BytesIO(fd.read()) | |
| im = Image.open(image_file) | |
| THUMB_SIZE = 150, 150 | |
| img = ImageOps.fit(im, THUMB_SIZE, Image.ANTIALIAS) | |
| img.save('thumb.jpg') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment