I am trying to use Python to resize picture. With my camera, files are all written is landscape way.
The exif information handle a tag to ask the image viewer to rot
Although PIL can read EXIF metadata, it doesn't have the ability to change it and write it back to an image file.
A better choice is the pyexiv2 library. With this library it's quite simple flip the photo's orientation. Here's an example:
import sys
import pyexiv2
image = pyexiv2.Image(sys.argv[1])
image.readMetadata()
image['Exif.Image.Orientation'] = 6
image.writeMetadata()
This sets the orientation to 6, corresponding to "Rotated 90 CW".