Ryan (tekman) wrote,

Using exiftool to fix busted EXIF

I have a large back-log of photos sitting on my mass storage, basically since the kids were born.

I've been working on how to get the stuff out of my private gallery2 instance and onto Photosleeve. One challenge is that some of my EXIF data is inconsistent. Specifically, we rotated some of our original images in a way that did not reset the EXIF Orientation tag. So in newer, savvier, orientation-aware image viewers (like ZoomBrowser or, in fact, Photosleeve) the image gets double-rotated.

As a quick fix, I've just cleared all the Orientation tags on Tall photos.

I did it with almost no effort, thanks to the incredibly wonderful exiftool, which can happily say I've put to use as a stand-alone perl script, a perl library, and a stand-alone Windows EXE.

Anyway, here's the awesomeness:

find . -name \*.jpg -print0 | xargs -0 exiftool -n -if '$File:ImageHeight > $File:ImageWidth' -IFD0:Orientation=

The inherent sexy power of the -if construct is thrilling. It also does super cool stuff like let you offset all the date-related tags by an hour with -AllDates+=1:00.

Don't leave home without it.
  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded