Skip to content

Instantly share code, notes, and snippets.

@cherian
Created December 18, 2012 06:29
Show Gist options
  • Save cherian/4325581 to your computer and use it in GitHub Desktop.
Save cherian/4325581 to your computer and use it in GitHub Desktop.
import ExifTags
import Image
img = Image.open(filename)
print(img._getexif().items())
exif=dict((ExifTags.TAGS[k], v) for k, v in img._getexif().items() if k in ExifTags.TAGS)
if not exif['Orientation']:
img=img.rotate(90, expand=True)
img.thumbnail((1000,1000), Image.ANTIALIAS)
img.save(output_fname, "JPEG")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment