Custom sort in lighttable, what is the base sorting?

Hi!

Recently I discovered the sort option Custom sort in lighttable. Interesting because that could of use for me in a typical use case making an extra step in the workflow in Digikam or XnView MP redundant.

Most of the time I create a digital ‘album’ only, eg of a holiday with a selection of 100-600 photo’s. The album will show the pictures roughly according to capture time. But most of the time I want to rearrange the sequence a little bit for a more logical visual story line.

Up to now I use Digikam or XnView to do the custom sort (drag and drop) of the exported images of Darktable based on sorting of the images on capture date-time. Then to ‘freeze’ the sorting, I rename the images using pattern -<Country/location>-####. So sorting on filename gives me the logical story line, without hampering with capture date-time of the pictures.

Enthusiastically I selected Custom Sort in lighttable. To my surprise, darktable immediately reorganized earlier sorting completely. Not on capture date and I don’t recognize what dt uses. Anyhow, custom sorting would now mean a full custom sort instead of rearranging a few in a base line sorting on creation date-time. Custom sort works differently than in Digikam or XnView.

The manual 4.8 offers no explanation as far as I can see. In an older version of the manual 3.4 there is some text on custom sorting.

When “tag” is at the first level of Collect module, the images order is saved along with the selected tag. As a tag can be seen as a collection of images, it is then possible to associate to every collection (or tag) a specific images order, including a “custom order”.

I set a tag and then a folder in the Collections module and tried again. Unfortunately, no difference.

OK, so now I’m back to my old workflow. Unless there is is someone out there who knows if custom sort in Darktable can be used for my use case and if so, how.

Best regards,
Henk

PS.
Working with Darktable 5.2 on Linux Mint 22.1 Cinnamon.

I played with custom sort a little bit. It appears that it works like this:

  • You have some sorted order (id, capture time, import time, etc.)
  • You select custom sort. The current sort now becomes the “custom” sort.
  • You rearrange by dragging and dropping.
  • If you go to another sort mode the images will be sorted in that order.
  • If you select custom sort again, then the images will return to the custom sorted order.

If you open another film roll with custom sort active I’m not sure what you’re going to get. I would make sure that custom sort is not active when changing film rolls.

3 Likes

Thanks Bill for your reply!

That was exactly what I expected. I had a collection / film roll sorted on capture time. Then I selected custom sort. At that moment DT resorted the collection using a unknown sort by. So I did not change to another film roll.

To examine further I renamed the .config darktable folder. Restarted DT, imported a folder, sort on creation date, change sort order to custom sort and same thing happens.

Since DT started ‘fresh’, now I could see that it sorted the pictures on ID. To my understanding that element is set during import.

Then what triggers DT to re-sort from e.g. capture time to ID at the moment custom sort is selected?

I didn’t see that, but if I do an import id, capture time, and import time would all sort to the same order so that’s probably why. I’m going to guess that custom sort uses id to manage the order. I’ll peek at the code and see if I can figure it out.

Some additional testing.
Sorting set to capture time

  • Import of all pictures in a new folder: no issue (no apparent re-sort).

  • Import of a second set of pictures added to the same folder with an older capture date-time. DT re-sorts the moment custom sort is selected.

  • Removal of all pictures. Re-import of the same pictures (so both sets): no issue when switching to custom sort. All pictures get an ID in the same order as the capture time.

It looks to me that DT gets confused when ID order is not logically the same as the capture time order?

Custom sort sorts by ID, so the older capture date-time has a higher ID number and therefore gets sorted after the newer capture date-time.

I experimented a little bit more, since the manual offers not very explicit details.

  • OK. Switching to Custom-sort sorts on the Image IDs. After that one can drag and drop selected images.

  • My experiments show that assignment of image-IDs happens in the order of images in the import dialogue. Images can be sorted on file name or modification date-time. Ascending or descending. The first in the list, gets the first ID, the last in the list gets the highest number. So which gets the lowest or highest is depending on sorting.

  • If one is unknown and adds images to a folder and imports using different sorting, the order based on ID is in fact no order at all.

All in all, I have no idea what the logic is behind sorting to image-ID. It means for now that I need to rely on other software to create my digital albums.

Thanks Bill for thinking along.

I’m not sure what this means. If you don’t mess with the sorting order on import, it’s imported by name, ascending. If you don’t mess with it, then it’s always imported the same way, with IDs assigned based on that order.

The data is in a database and ID is the primary key for the record. If you are talking about custom sort using ID, then how would you do it? What would you use to keep track of the order?

If you manipulate the sort order on import, it’s the order you chose. In all the years I’ve been using darktable I’ve never changed the import sort order. Therefore, all my imports are consistent.