Many cameras take note of their orientation when a photo is taken. This information is embedded into the JPG image as exif data (think “meta data”). This tells applications that they should rotate the image a certain amount before displaying it. It’s a great feature — for applications that support it. OS X’s Preview application supports it in 10.4, but all web browsers I have tried do not. Flickr supports auto-rotation (if you enable it), but it doesn’t auto-rotate your original image… that’ll be stuck sideways.
What I needed was a quick way to losslessly rotate the actual images, based on the exif rotation flag. A quick search didn’t reveal anything that only did that, and it’s more fun to roll your own, so that’s what I did.
Go here to download my solution.
The muscle is provided by the public domain program jhead, which in turn uses the public domain program jpegtran. The Apple-friendly layer is provided by Automator. After installation (sorry, you’ll have to muck around manually), you’ll be able to simply drop your exif-rotated JPG images onto an application and they’ll automatically be rotated according to the exif rotation flag and then have their rotation flag set to the “no rotation” setting. The Automator script takes care to only touch JPG files, so if you have a folder with a mix of JPG and RAW files (JPG+RAW modes rock), you can select everything and drop it without worries.
For Unix geeks, this is the command being run: jhead -autorot image.jpg
This isn’t anything revolutionary, but it solves an annoyance I was experiencing, so I thought I’d pass it along.
Thanks to my wonderful girlfriend-with-a-rock (we loathe the f-word) Sarah, whose annoyance at my un-rotated Flickr photos prompted me to do something about the matter.