This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Digikam: change tag structure hierarchy, existing collection

Tags: None
(comma "," separated)
furryspider
Registered Member
Posts
14
Karma
0
OS
Hello,

I've been doing a search for similar topics in several places, but couldn't find an answer to my particular problem. Sorry if this has been asked before, or if this isn't even the right place to post this.

My situation is this:
I have a collection of photos, some 20000+ pictures. Large portions of these have been tagged, using a tag structure that seemed to make sense at the time. It is important for me to have the metadata not only in the database of my photo management software (Digikam at present), but also independent of this inside the image files.

What I wish to achieve:
Parts of the tag structure hierarchy have turned out to be too volatile and/or the depicted subject cannot be categorized clearly enough to follow one particular hierarchy branch. I would like to move certain tags around, either under other branches, or just simply up a step or two in the structure hierarchy. Like e.g.:
MyTags/Customers/Firm-A/Division-I/Product-1 ...should become: MyTags/Customers/Firm-A/Product-1
or MyTags/People/Family-1/Person-ABC ...should become: MyTags/People/Family-2/Person-ABC

Simpleton that I am, I'd wish that I could just load all my existing image collections in Digikam, move things about in my tag structure, and then have Digikam sync the image metadata with the database, either by writing the metadata to the image, or via "maintenance". That last step however does not seem to work. In my tests, the images retain the old structure hierarchy.

What I would like to avoid is having to do a tag search for images, give them a 'temporary marker tag', remove the tag in question, save metadata to images, move tag around, re-assign to those images with the marker tag, remove marker tag, then again save metadata to images. I just have too many tags (and images) for this to be a good workaround.

Any hints how to achieve this 'structure change' would be appreciated. Also, if this isn't the right place for the question, I'd appreciate links to active forums focussing on Digikam, since I wasn't able so far to find much in that area.

Thanks in advance!
furryspider
Registered Member
Posts
14
Karma
0
OS
In case anybody has similar issues, here's what I did:

First off, it seems like Digikam in its present version is unable to achieve the abovementioned objective. So instead of trying to get Digikam to do something it's apparently no good at, I decided to fiddle around with the very tool that Digikam employs to write metadata to the image files: exiv2

First I checked a lot of my images like so:
Code: Select all
exiv2 pr -p a image.jpg

The metadata keys in question (which store parts of the tag hierarchy) were always these:
Xmp.digiKam.TagsList
Xmp.MicrosoftPhoto.LastKeywordXMP
Xmp.lr.hierarchicalSubject

The last two seem to be keys used by proprietary software (lr meaning "Adobe Lightroom", apparently). Damned if I know why these are written to my pictures at all.

Anyway, outside of Digikam, I mounted all my image collections under one directory and from there cleaned out those keys using this command:
Code: Select all
find . -type f -print0 | xargs -0 exiv2 mo -M "reg lr dummyNameSpace/" -M "del Xmp.lr.hierarchicalSubject" -M "del Xmp.digiKam.TagsList" -M "del Xmp.MicrosoftPhoto.LastKeywordXMP"


This portion...
Code: Select all
-M "reg lr dummyNameSpace/"

...was necessary because without it, exiv2 would complain about the lr-key being invalid and wouldn't touch it.

Then I opened Digikam and moved the tags around to my heart's content. Afterwards, I had it sync the database with the image metadata through 'maintenance'. On my present machine, this process took more than a night to complete, which made the several hours of the earlier exiv2 command look fast as lightning.

The result is pretty much what I wanted.
Since I'm not overly keen on repeating this soon, I guess I'm gonna take great care about my choice of tag hierarchy branches...

Considering this solved.
User avatar
ianp5a
Registered Member
Posts
64
Karma
0
Well done and thanks for sharing. It's just a shame that it is not possible to do directly in Digikam.
User avatar
apater
Registered Member
Posts
18
Karma
0
furryspider wrote:Xmp.digiKam.TagsList
Xmp.MicrosoftPhoto.LastKeywordXMP
Xmp.lr.hierarchicalSubject

The last two seem to be keys used by proprietary software (lr meaning "Adobe Lightroom", apparently). Damned if I know why these are written to my pictures at all.

Invented by, not proprietary too.

As long as those properties are in wide use by different apps, there is no danger in using them, in fact it is a good idea to have your tags written to various keys, just in case. Same goes for the proprietary xmp.digikam.tagslist. As long as other apps can works with those properties, they are safe to use. If you move to another image manager in the future, you want to be sure that your tags are readable by whatever that application may be.


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rblackwell