Defying Classification

by Malcolm Tredinnick

Tue 19 Sep 2006

Photo EXIF Woes Solved (Or Worked Around)

Posted at 19:58 +1000 (last edited: 3 Oct 2006, 17:52)

Following my post last week about Flickr's interpretation of my photos' EXIF metadata, I spent a little more time this afternoon looking deeper into the problem.

End result: I understand the problem a bit more and have a workable solution...

Without going into too many gory details, it turns out that UFRaw, the useful tool I use to convert Nikon's propietary raw format into JPEGs, does only a so-so job when copying over EXIF information. UFRaw uses libexif to copy the EXIF data from the original to the converted file. Unfortunately, although it copies most of the relevant pieces, it somehow does not quite copy all the information that is needed. I am in no sense an EXIF expert, so I can only say that based on another tool (see the next paragraph), things are not quite whole.

I started experimenting with Exiv2, another EXIF reader and writer. It has a much wider understanding of the various Nikon-specific tags, it appears and I could see that my converted images had the right hex values, but not all the names copied correctly, or something like that.

So, to cut a long story short, I now have another step in the conversion pipeline. After using UFRaw to convert from NEF to JPEG, I then run

exiv2 in -S .NEF -l <path-to-originals> *.jpg
exiv2 fi *.jpg

in order to copy over all the metadata from the original to the converted image (the second command copies the ISO setting from the Nikon-specific fields into the otherwise empty standard "ISO speed" field).

Uploading the results of this to Flickr gives me a lot more information. Compare this "before" attempt with the information available in this photo. Along with the time being entered properly, things like the aperture, shutter speed and focal length are interpreted correctly.

It's still annoying that Flickr gets it half right, but I can now understand what's going on under the covers and can fix it at my end. Now, if only there was a way to tell Flickr that my camera's clock is in UTC and not my local timezone (no timezone in the EXIF data, so Flickr guesses; to the detriment of those of us who travel).

Updated 3 October, 2006: I am working around the timezone issue by running

exiv2 -a 10:00 adjust *.jpg

on the photos (assuming I am in Sydney and it's not Daylight Savings time). This adds ten hours to the timestamp in the photo data. So I can keep the camera in UTC and adjust for the local time easily, wherever I may be. Since I'm already running two other exiv2 commands, one more doesn't matter much.

Topics: software/linux, photography