Fix incorrectly-rotated iPhoto photos for Apple TV

Dec 06, '07 07:30:00AM

Contributed by: Anonymous

iPhoto 4 (and earlier) did not play well with EXIF rotation tags. As a result, photos that were rotated under iPhoto 4 will probably display incorrectly when viewing them on Apple TV. The problem is also apparent when viewing the photos with Preview or other programs.

Apple's suggested solution is to revert the messed-up files to their originals. Of course, doing so loses all iPhoto edits, so it's not ideal. I've managed to figure out how to fix the EXIF tags of the modified files so that the photos will display correctly without reverting them.


  1. This involves some light work in the Terminal. If you're not comfortable with that, you'd probably be better off following Apple's suggestion.
  2. It's always wise to have a backup of your iPhoto library, just in case you make a mistake and want an easy way to revert to where you started.
  3. I'm using iPhoto 6, not iPhoto 7 (which is the latest version). The instructions shouldn't change much, but in iPhoto 7, you'll have to deal with the library being wrapped as a package. And there may be other minor differences I'm not aware of.
Read on for the detailed how-to...

Here's how to fix the incorrectly-rotated images:

  1. Verify that you're dealing with the same problem I am. The major symptoms are that the image(s) appears correctly in iPhoto, but is rotated incorrectly in Apple TV. Also, the image should have been modified (probably rotated...) under iPhoto 4 or earlier, which means it was probably taken in 2004 or earlier, and if you click on the "Photos" menu while it's selected, "Revert to Original" will not be greyed out. Finally, if you open the photo in Preview (Control-click on the photo, select Show File, then double-click to open), it should appear incorrectly rotated, as in Apple TV. If any of these things are not true, you should probably stop now, because we're not dealing with the same problem.
  2. Identify all the messed-up files, and put them in a new iPhoto album. This is the most tedious step. I just set my Apple TV to two-second delay, played the Library slideshow, and followed along on my computer, dragging each messed-up photo into the new album I had created.
  3. Download ExifTool, a command-line utility that will let you modify jpeg metadata. I didn't bother with the Mac OS X Package download; I just used the generic download link at the top of the page.
  4. Open Terminal, and cd to the ExifTool directory.
  5. Just to make sure things are working as expected, display the Orientation tag for one of your files. Type ./exiftool -Orientation, then press the Space Bar, and don't press Return. Drag one of the messed-up photos into the Terminal window. The name of the file will appear on the command line. Now hit Return. You should get this output:
    Orientation : Horizontal (normal)
    This is actually the correct setting, but what exiftool isn't telling you here as that there are duplicate Orientation tags in the file, and the other one (which shouldn't exist at all) is incorrectly set to something else. We want to fix that. (You might think that Horizontal is wrong, since the image actually has portrait orientation. But the problem is that iPhoto 4 manually rotated the image's pixels without touching the orientation tag. Thus, the image has been rotated twice when it displays, and we want to eliminate one of those rotations.)
  6. Type ./exiftool -Orientation=Horizontal, and press the Space Bar and don't hit Return. Drag the photos you want to fix into the Terminal window (it might be wise to try just a few first, to make sure it works...). Before hitting Return, make sure each listed file appears in iPhoto Library/Modified, not iPhoto Library/Originals -- you don't want to be messing with any originals. Hit Return. You should see this for each file:

    Warning: Duplicate Orientation tag in IFD0 - /Users/Shared/iPhoto Library/Modified/2004/Roll 31/IMG_0861.JPG

  7. The photos should now display correctly. Check to make sure.
If you'd like to, clean up the backups that exiftool has created by executing this command (entered exactly, but obviously changing the path to point to your photo library):
find "/Users/Shared/iPhoto Library" -name "*JPG_original" -exec rm {} ;
Please be very careful with this command -- it will permanently delete files. If you want to make sure you're deleting the correct files without actually doing so, leave off the -exec and subsequent stuff. Doing so will just list the filenames, not delete them.

Comments (3)

Mac OS X Hints