Digital Camera EXIF Orientation Issues

published on 2006-11-06 in computing

Problem: Most modern Digital Cameras do not actually rotate an image based on the orientation, they just set a flag in the EXIF headers. Most software (including iPhoto and Preview on the Mac) will display the image properly by rotating it on load. But uploading to online based services means you have an image with the wrong orientation. The ones that plauge me are Flickr, Wikipedia, Gallery2 and vMix Slide.

jhead + jpegtran. jhead will read the EXIF headers, detect the oritentation and then call jpegtran to do a lossless rotation on the image, saving the proper EXIF headers back to the file. What does that mean? It means you will have a file that is properly oriented for display on your editing software and for uploading to online services.


There are jhead binaries for linux, mac, windows. To install jpegtran on OS X I used the Fink software package. On Linux I used yum.

To automatically detect and rotate to the proper orientation, run this on the command line (OS X Terminal):

# jhead -autorot *

Easy and fast. I ran this on all the images I have taken with my new digicams, it only took a few minutes to run thru a few thousand photos.

Tags: photography linux