Digikam Tagging

I’ve recently switched from Picasa (which has been retired) to Digikam for photo management and I’ve noticed a few quirks that I need to document to or I’ll forget them. For the most part Digikam is a massive upgrade over Picasa but a few things in Digikam don’t necessarily work quite as I’d expect them to.

Metadata

The most important settings in Digikam are under Settings > Metadata, the check boxes on this page decide what metadata information gets written to the images such as tags and ratings. You’ll spend a lot of time tagging or otherwise adding metadata to images and it really makes sense to store that information in the file as well as the database Digikam uses. In a worst case scenario where you lose your Digikam database you can recover essentially all the information from the files themselves.

Tagging

I like to tag my photos so that it’s easier to find relevant images in the future. Mostly that just means a tag for the basic category, people in the photo and if it warrants it a more detailed category. Digikam supports tag hierarchies but there are a few caveats you need to know about in order to use them correctly.

As far as I can tell Digikam writes tags to two different metadata blocks(1): XMP and IPTC. XMP is the newer (introduced in 2001) method of storing metadata but it still (2017) doesn’t seem to be adopted everywhere – in fact most of the software I tried out while trying to understand what was going on only seemed to access the IPTC data.

Tags in Digikam might be entered something like this: /Places/London. This would be a tag called London in the group Places. When this tag gets written to the file it appears to be written several times in different formats. In the IPTC block it’s written as an entry called Keywords and has the value “Places, London”. In the XMP block it’s written in several different entries. There’s the entries Hierarchical Subject and Catalog Sets where it takes the value “Places|London”. There’s the entries Last Keyword XML and Tag List where it takes the value “Places/London” and then there’s the Categories entry where the tag is stored in a blob of XML.

The key point though is that in the IPTC metadata the tag hierarchy gets written as two separate tags not as a hierarchy of tags. This comma separation of tags rather than using slashes to denote levels becomes a problem when you have two child tags with the same name but different parents. For example imagine you have tags: /Places/England/Birmingham and /Places/America/Birmingham.

With the default Digikam settings only the selected tag is written to the file so the metadata stored in the IPTC section for photos from Birmingham, US and Birmingham, UK will be just “Birmingham”. Digikam is able to read the XMP metadata which will include the full hierarchy and so it can differentiate between these two Birmingham instances. Other applications reading only the IPTC metadata though will only see the tag “Birmingham” and will therefore mix the two cities together. If the worst happens and the Digikam database is lost presumably it can rebuild the hierarchy from the XMP data.

This lack of hierarchy information in IPTC tags also leads to another potential problem. If a file is tagged at more than one location in the tag hierarchy then all the tags get stored as a single long comma separated list. At best this will appear as a jumble of tags at worst it will make an image appear to be in a hierarchy it wasn’t really in.

Work Around for IPTC

The best I can come up with as a work around for IPTC tags is to make every tag fully meaningful on its own. For example create the tags /Places/Birmingham (US) and /Places/Birmingham (UK). This somewhat reduces the usefulness of the tag hierarchy but it does mean that the metadata will make some sense in software that only supports IPTC.

Additionally you probably want to turn on auto-parent tags as well since it will ensure your tagging efforts always include the parent tags. Unless you know where this setting is you probably won’t find it, right click on any tag and then select Toggle Auto from the menu and select Parent (the default is None). This won’t fix the fact tags are written as a comma separated list in IPTC but it will at least let you see what the parent tags of the image are.

Moving Tags

As part of my move to Digikam I decided to re-organise some of my tags. It turns out that if you move a tag in the tag hierarchy it doesn’t seem to automatically update the metadata for the images associated with that tag. to correct this ensure you have auto-parents switch on (see above) then select the newly moved keyword. Select all the images associated with the moved keyword then in the tags panel deselect the keyword and reselect it. When you hit apply the tags will all be written to the files.

Notes

(1) It also write EXIF but that isn’t relevant to this section.

References and Tools

Posted in Miscellaneous and tagged , , .

Leave a Reply

Your email address will not be published. Required fields are marked *