I'm scaling and rotating some JPEGs using PythonMagick. Ideally, I could update the EXIF Orientation tag as well. However, while I can retrieve the value of this tag, I can't seem to modify it. Consider:
from PythonMagick import Image
i = Image("image.jpg")
print i.attribute("EXIF:Orientation")
i.attribute("EXIF:Orientation", "5")
i.write("image-modified.jpg")
Running this shows the original orientation of your image:
exarkun@top:/tmp$ python broken.py
6
exarkun@top:/tmp$
And as long as it wasn't 5 to begin with, exiftool will demonstrate that the new file has not had its orientation adjusted:
exarkun@top:/tmp$ exiftool image.jpg | grep Orient
Orientation : Rotate 90 CW
exarkun@top:/tmp$ exiftool image-modified.jpg | grep Orient
Orientation : Rotate 90 CW
exarkun@top:/tmp$
Why doesn't ImageMagick write out the modified orientation? How can I get it to?