3
\$\begingroup\$

I want to keep my metadata in the digikam database (only), i.e. not write it to the EXIF data. However, I'm afraid that if I rename photo files or move them to a different folder, digikam won't be able to recognize them anymore and the metadata (ratings, labels etc.) will be lost.

So how does digikam identify photos? By path? By checksum? By timestamp / EXIF data?

Put differently, what do I need to keep constant about a photo/file in order to ensure that digikam will still recognize that photo and not mistake it for a "new" one that it hasn't seen?

\$\endgroup\$

2 Answers 2

4
\$\begingroup\$

Looking at the Digikam database (SQLite version):

  • Photos are identified with unique IDs
  • These ids are linked to a file name and an "album", and a "hash"(*)
  • An "album" has among other things a relative path and a root

So it's not as simple as it looks (even though it makes perfect sense to a programmer like me, this is a rather plain relational database).

Experimentally:

  • I created a "Marker" tag
  • I attached it to an existing picture
  • I exited Digikam
  • I created a directory (under Digikam's "root")
  • I move the picture to it
  • I restart Digikam and:
    1. The new directory and picture are there
    2. The picture still has the tag.

Looking at the database contents, the moved picture still has its original ID, so Digikam detected that it was moved. Given the presence of the hash in the image data, this is not surprising.

More experimentation:

  • Behing Digikam's back, I move the file out of its reach
  • I open Digikam, check that the file isn't there, close Digikam
  • Inspect the database again, the image is still there, but is not associated to an album
  • Move the image back under Digikam's root
  • Open Digikam: the image is there and still has the "Marker" tag
  • Looking at the database contents, it is still the same image id, but it now has an album.

So, all in all, Digikam data seems fairly resilient to file manipulation done outside of it.

Tests done with Digikam 7.5.0.

(*) A hash is a (large) number derived from the file contents (checksum on steroids). Two different files are very unlikely to have the same hash, and if you are given a file, you can compute its hash, and see if you have any other files with the same hash. If not, the file is new, if yes, you only have to compare it with the very few that have the same hash to identify it.

\$\endgroup\$
5
  • \$\begingroup\$ Wow, thanks so much for the comprehensive experiments! I feel much more confident now about using digikam while still using my file explorer from time to time as a low-key way to organize my photos. \$\endgroup\$
    – balu
    Apr 30, 2023 at 21:29
  • \$\begingroup\$ Interestingly, digikam doesn't seem to identify duplicate photos/files yet. That is, giving copy 1 a rating of X apparently doesn't cause copy 2 to carry the same rating automatically (even though they should both have the same hash). \$\endgroup\$
    – balu
    Apr 30, 2023 at 21:30
  • 1
    \$\begingroup\$ It does, but not the way you think. If it find an unregistered image (because you made a copy behind its back), it recognizes it and this copy gets the labels and tags of the known instance. But from then on they are distinct images, if you make changes to one they won't be copied to the other. \$\endgroup\$
    – xenoid
    Apr 30, 2023 at 21:39
  • \$\begingroup\$ I see, thank you. But in this case moving / renaming won't work reliably, anymore, right? For instance, let's say the two copies are now treated as distinct images and I set different labels for them. If I now rename both copies (or remove one copy and move the other), then I assume the tags will be gone because digikam has no way of knowing which photo is which? \$\endgroup\$
    – balu
    May 3, 2023 at 9:06
  • \$\begingroup\$ if you have duplicates and you add a third dupicate, it seems the last duplicate is used to copy data. But if both a removed DK gets lost. OTOH, to get there you have to continuously switch between DK and your file manager, not too likely IRL. \$\endgroup\$
    – xenoid
    May 3, 2023 at 10:49
1
\$\begingroup\$

Easy, use digikam to rename photo files or move them to a different folder.

Of course you can use any file explorer, but it isn’t easy to track renamed, or moved, files. Just think of Digikam as the file manager for images and videos, it’s easier than all of the other answers.

\$\endgroup\$
1
  • \$\begingroup\$ That was not my question, though. :) I want to keep using my file explorer to manage my files. I only open digikam occasionally. \$\endgroup\$
    – balu
    May 3, 2023 at 9:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.