I wanted to post this ever since I came up with a fairly automated solution to add EXIF data to my film photos, but never found the moment to write about it. Now that two people have showed interest in it, I can’t hold it any more.

The short answer that everybody gives to this question is use software X to edit the EXIF, but there is more to talk about when it comes to automate the process, thus saving (a lot of) time. No matter how fancy and user-friendly the GUI is, there is always a few hundred (or thousands) photos to start with and you don’t want to spend endless hours tagging photos in small lots, you want it snapping. That is what this post is about.

Well, it all depends on how do you keep your photos organized, but in a nutshell all you need is some sort of tagging system that lets you pull the tags for any photo in an automated fashion, so that you can run a random, customizable action on every photo, depending on each photo’s tags. An example follows.

I use digiKam for organizing my photos, all the tags and other information digiKam keeps about the photos is stored in a single file. This file is a SQLite database that I can read using any software, including a simple Python script.

I wrote exif-film-tags for this purpose, along with a few other EXIF scripts for simpler, tag-independent modifications. The exif-film-tags script gets a list of photos (JPEG files) and search them in digiKam’s database, extracts the tags that matter (e.g. “Nikon FM-2n”) and runs exiv2 to insert EXIF tags in each photo. I could possibly use ExifTool instead, but I found exiv2 first.

If you use digiKam and have exiv2 installed, all you need to do is modify mapping from digiKam tags to EXIF tags in exif-film-tags is the only bit you need to reflect your own digiKam tags and how do you want them to translate into EXIF tags. Many of my EXIF tags are Nikon3, pretty useless for Canon users but I use Nikon

That is pretty much it: add tags to the photos in your favorite desktop (even possibly on-line) photo organizing software, then run a script that translates each photo’s tags into EXIF tags to write in the JPEG file and insert them.

There are innumerable possible ways to achieve this running on the same principles, so if you want more (gory) details read on to learn the bits you need to put together to build your own automated solution.

Tags in digiKam can contain other tags (unlike Flickr tags) so I organized them in a tree structure: there is Camera body, Lens, Film and so on, each containing the relevant tags for each attribute. Hence Camera body contains the following tags for my camera bodies: Nikon FM-2n, Nikon F90X, Olympus OM-1 and a few more.

The exif-film-tags script receives a list of file names and look them up in digiKam’s database and extracts the tags whose parents are Camera body and the like, those are tags the script care about. Each one of these is mapped to a set of EXIF tags and values to assign to them, and that is what the script does in the end: insert EXIF tags with the values mapped to from digiKam tags. For instance, my digiKam tag Nikon FM-2n, child of Cuerpo (body), is mapped to the following:

"Nikon FM-2n": {
"Exif.Image.Make": "NIKON CORPORATION",
"Exif.Image.Model": "NIKON FM-2n",
"Exif.Photo.ExposureProgram": "1",
"Exif.Photo.MeteringMode": "2",
"Exif.Nikon3.Focus": "MANUAL",
}

Strings on the left hand side are the EXIF tags, expressed in the hierarchical notation used by exiv2, and on the right hand side their values. To find out what EXIF tags you want to insert, you can consult with your cameras manufacturers’ reference or just run exiv2 -pv anyphoto.jpg on any photo taken with your camera.

The above tags represent the properties I found appropriate to associate with a Nikon FM-2n, a manual camera with only center weighted average metering:

Camera: Nikon FM-2n
Exposure Program: Manual
Metering Mode: Center Weighted Average
Focus Mode: MANUAL

The last three properties are not constant for a Nikon F90X, so I have a set of digiKam tags for them. Adding film, lens, exposure and copryright details, it all sums up to 20 EXIF tags for photos like this one.

Adding time stamp is also interesting, but I still do this manually taking time stamps from digital photos done around the same time and usually on the same place, so that an approximate time stamp lets me get a fairly accurate geotag from the GPS logger. If only I had this automated as well…

See also: How you could add EXIF tags to your film photos.