Skip to content

Instantly share code, notes, and snippets.

@mikeyakymenko
Last active December 31, 2015 11:49
Show Gist options
  • Select an option

  • Save mikeyakymenko/7982301 to your computer and use it in GitHub Desktop.

Select an option

Save mikeyakymenko/7982301 to your computer and use it in GitHub Desktop.
Python thumbs
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