Ben Whittaker

Embedding KPhotoAlbum Tags as Image Metadata

My Mother is an old Linux geek, and she has a lot of photos. In the past she’s mostly used KPhotoAlbum for her photo management purposes, but recently she’s felt like development is lacking, and she’s been experimenting with tagging her photos in digiKam. The problem with this is although digiKam will work with tags embedded in the images themselves, KPhotoAlbum stores it’s tags separately, and has no easy way of embedding them into the image files. This means that if she switches to using digiKam, she’s leaving years of careful tagging and organization behind.

To solve this problem, I made a script! kphoto2meta.py is a python script that parses all the keywords, people, and places contained in KPhotoAlbum’s index file and embeds it in the images themselves using exiv2.

To use it:

  • Make sure that exiv2 is installed (sudo apt-get install exiv2)
  • Download kphoto2meta.py from here
  • Place the script in the same directory as KPhotoalbum’s index.xml file
  • Run the script (python kphoto2meta.py)

It should be pretty non-destructive (which is to say, if any images have existing tags embedded, it will merge the new tags and the existing tags instead of overwriting them), but I still recommend backing up your collection beforehand. I’ve only really tested this once, on my mother’s 30000+ photo collection, but it worked fine there!