Why are images with similar filenames grouped on second import? [SOLVED]

Hello. I noticed an odd behavior in darktable (versions 4.2.1 and 5.0.1) and wondered if someone could help me understand it.

If I import two different photos named test.jpg and test_1.jpg, they import as two separate photos, as expected.

However, if those photos have pre-existing xmp sidecar files (test.jpg, test.jpg.xmp, test_1.jpg, test_1.jpg.xmp), then test.jpg shows up in darktable twice as a grouped image, and darktable makes a new xmp file test_01.jpg.xmp. So then there are three photos shown in darktable, when there are still only two photos on disk.

This behavior is confusing and hinders my workflow.

Can someone help me understand why darktable is doing this, and how to avoid it?

You can see the behavior yourself by doing the following:

Copy two JPG files to a new folder.
Rename them to test.jpg and test_1.jpg
Import the new folder (add to library)
Remove the two pictures from the darktable library
Import the new folder (add to library) again, and now the problem occurs.

I tested with test.jpg and test_2.jpg and the same problem occurs; now darktable creates test_02.jpg.xmp

Suggestions for a different file naming scheme are welcome as well. I am currently using: YYYYMMDD_HHMMSS.jpg, and YYYYMMDD_HHMMSS_X.jpg for additional photos on the same second (where X is a counter starting at 1). These photos do not have milliseconds nor sequence numbers in the EXIF metadata.

Thank you for your time!

I think your naming scheme is running afoul of the darktable duplicate naming scheme. When you open an image and create a duplicate, darktable creates another xmp file named original_file_name_01.filetype.xmp. Duplicates are automatically grouped with the original.

So, when you reimport existing xmp files with the underscore digit naming sequence that causes darktable to believe the images are duplicates.

I use a yyyymmdd-hhmmss_originalFileName.ext scheme. That ensures uniqueness and sortability.

Thank you both. That makes sense. I changed the underscore to a hyphen at the end and that fixed the issue. That will work for me. Hope you have a great day!

2 Likes