Skip to content

Instantly share code, notes, and snippets.

@mboldt
Last active August 10, 2016 17:50
Show Gist options
  • Save mboldt/f4945b77479f8ff913c4b1b03d3e484f to your computer and use it in GitHub Desktop.
Save mboldt/f4945b77479f8ff913c4b1b03d3e484f to your computer and use it in GitHub Desktop.
Python crop and resize image
from PIL import Image
im = Image.open('original.jpg')
imc = im.crop((0, 0, 400, 400))
imr = imc.resize((300, 300), Image.LANCZOS)
imr.save('cropped-and-resized.jpg')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment