jhead to the rescue once again

While going through the pictures of our recent vacation, I once again noticed that we forgot to adjust the clock on the camera and so had a bunch of pictures with the wrong timestamps. Remembering that I previously had luck with a great command-line EXIF manipulator called jhead, I figured it could do the trick once again. That was back when I was on Windows and I had used jhead in Cygwin. Now I’m on a Mac and I’m giving iPhoto a spin for dealing with my photos. Luckily, jhead is available in Fink:

~$ sudo fink install jhead

The next question is where does iPhoto store photos? Easy to figure that one out.

~$ locate IMG_0521.JPG
/private/var/tmp/folders.8284/TemporaryItems/iPhoto/IMG_0521.JPG
/Users/marca/Pictures/iPhoto Library/2006/09/24/IMG_0521.JPG
/Volumes/512 MB CF/DCIM/105CANON/IMG_0521.JPG

Clearly, the second one is the right answer here.

Now how does one adjust a timestamp with jhead? I typed jhead -h to refresh my memory:

  -ta<+|->h[:mm[:ss]]
             Adjust time by h:mm backwards or forwards.  Useful when having
             taken pictures with the wrong time set on the camera, such as when
             travelling across time zones or DST changes. Dates can be adjusted
             by offsetting by 24 hours or more.

Now since my photo timestamps were an hour behind starting from 9/24 (IMG_0521.JPG was the first photo we took after traversing timezones):

~/Pictures/iPhoto Library/2006/09$ jhead -ta+1 24/*.JPG 25/*.JPG

All cool? Not exactly. Though this updated the files, iPhoto refused to see the changed times. I tried using the Option+Click trick for rebuilding iPhoto 5 libraries mentioned here but that still didn’t get iPhoto to acknowledge the adjusted times.

Finally, I ended up simply deleting the photos with the wrong timestamps out of iPhoto, using jhead to adjust the timestamps on the CompactFlash card, and then reimporting into iPhoto.

The jhead command was a hair more complicated because of the weird directory and filename structure that Canon uses (why don’t cameras just use the date and time stamp for the filenames?)

/Volumes/512 MB CF/DCIM$ jhead -ta+1 105CANON/IMG_052[1-9]*.JPG 105CANON/IMG_05[3-9]*.JPG  105CANON/IMG_0600*.JPG 106CANON/*.JPG

So it all eventually got done, though I had the feeling that it took more effort than it should. If anyone knows a slicker way to do this sort of thing, let me know.

Leave a Reply

Your email address will not be published.