Skip to content

Instantly share code, notes, and snippets.

@philippbosch
Created October 9, 2012 10:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philippbosch/3857869 to your computer and use it in GitHub Desktop.
Save philippbosch/3857869 to your computer and use it in GitHub Desktop.
from PIL import Image
im = Image.open(myfile)
info = im._getexif()
orientation = info.get(274,1)
if orientation == 3:
im.rotate(180)
elif orientation == 5 or orientation == 6:
im.rotate(90)
elif orientation == 7 or orientation == 8:
im.rotate(270)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment