Skip to content

Instantly share code, notes, and snippets.

@widyakumara
Created November 30, 2012 15:49
Show Gist options
  • Save widyakumara/4176564 to your computer and use it in GitHub Desktop.
Save widyakumara/4176564 to your computer and use it in GitHub Desktop.
simple resize & crop with python & PIL (using ImageOps)
import PIL
from PIL import Image, ImageOps
def resizecrop(src, out, width, height):
img = Image.open(src)
img = ImageOps.fit(img, (width, height), Image.ANTIALIAS, 0, (0.5, 0.5))
img.save(out)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment