I used ChatGPT to create a Lua script for me at GitHub - Karut/darktableluascripts and I wanted to import it to Darktable to see if it works. It says “no scripts found to install”. Using Mac OS. I installed Git on my system.
darktable doesn’t expect scripts somewhere in GitHub. So maybe you give some more detailed information about your system, explain, what exacltly you did, where you stored your lua script etc.pp…
Do you have the darktable Lua scripts installed? If so you should see script_manager in the bottom left panel. If not you’ll see scripts_installer in the bottom left panel.
If you see scripts_installer, then open it and click the execute button to install the Lua scripts.
When you see script_manager in the bottom left panel you can open it and select install/update scripts from the action dropdown. Enter the URL of the script and a folder name to put it in (it will be created). Click the install button to add the script to the installed scripts. Once it’s installed, select start/stop scripts from the drop down, then select the name you gave for the folder from the folder list, then click on your script to start it.
I infered that Darktable simply copies the luas files in the git repo to the specified Darktable folder (
).
There is only one .lua file in the git repo (link).
The goal of the script is for Darktable to change the leader of an image group based on the import timestamp (with the image having the latest import timestamp being on top). I sometimes use other programs (like X Raw Studio) to create variants of my jpeg files and want these to be the group leader of the image group.
I used the auto group und change group leader (to jpeg) lua scripts that comes with darktable by default. They do group the images according correctly but the desired image does not come up on top.
Somehow the script was now downloaded to the local folder
When loading it in the script manager is failed to load though. ChatGPT probably just messed up writing the script.
Perhaps I will open another topic and someone can review the lua script for errors. I would also be happy to donate a few bucks to anyone as a small bounty. This is really the only Darktable feature that I miss.
New folder should have just been a single word, not a path, i.e. ChatGPT. That would create a folder in your lua scripts named ChatGPT which would be located at $HOME/.config/darktable/lua/ChatGPT.
I looked at the script. It wont load, it wont run, and it wont do what you want based on the name of your script.
Also,
to do what you want would require an API change since import_timestamp is not exposed.
the import timestamp only has second resolution so if the images were consecutive they would all have the same timestamp
I would solve this with 2 nested for loops, the first to find groups and the second to find the earliest timestamp. The generated code does a lot of unneeded work to try and solve the problem.
Fair enough, point taken. My thinking was that ChatGPT was perhaps creating a good starting point and reviewing it be reasonable request. You also left out me saying “I would also be happy to donate a few bucks to anyone as a small bounty.”
Sorting by import_timestamp isn’t going to be effective if you import all your images at the same time. My system imports images at ~90/sec and import_timestamp only has 1 second resolution.
As far as payment, how about a trade. I’ll code up a script and in return I’d like to use your ChatGPT generated one as a comparison to show what ChatGPT generates versus a working piece of code.
My workflow is that shoot JPEG+RAW in my Fuji camera (which already produces pretty good SOOC images, hence I am not only shooting RAW). I import these into DT (first import timestamp), later I sometimes create another batch of JPEG variants in X-Raw Studio (using Fuji Film Simulations) and import these later into DT (second import timestamp) and other times I create entirely new variants inside Darktable that I then export to the orignal folder.
All these images are supposed to be automatically grouped, which I achieved with the auto group lua script.
My goal with this script here was that the images in the group are automatically ordered to have the last edited image on top of the group stack. By last I mean the latest edit like the imported JPEG from X-RAW Studio or exported from within Darktable after editing the RAW image.
My idea was sorting the group stack by import timestamp should achieve this. That doesnt work out though. I justed check that an exported image in Darktable (which is then automatically imported) does not get an import timestamp.
Another idea was that this could be achieved with the change timestamp but this information is not extracted from the OS file system thus importing files created from an external raw developer like X-Raw Studio leaves this field blank.
Long story short: I think the most straightforward way would be to have the group stack by sorted by the image file names (from “A to Z”) with the “last” image being on top of the group.
From created first to last:
DSCF6710.jpeg (SOOC jpeg)
DSCF6710.RAF (RAW file)
DSCF6710(1).jpeg (image from external raw developer)
DSCF6710(1)_01.jpeg (exported from Darktable)
This is what a typical group of images looks like for me. And I would like the images be displayed in that order in the group. I would hide the Raw file otherwise it would be on top of the group if I only have a raw file and sooc jpeg in the group.
The script would ideally apply the sorting for selected images, not the entire collection.
If I sort the images of a group by name in ascending order then the last image is the one you want as group leader? Is there a case where this isn’t correct?
If the image naming corresponds to processing order, then display the images sorted by filename in descending order would work, but you’d have to sort the whole collection that way.
However…
I have a script toggles the lighttable collection between a group and the whole collection. When you’re in lighttable view and you hover over a group you hit whatever keystroke you’ve assigned to the script and it replaces the collection with just the group. Hit the shortcut a second time and the collection switches back to the original collection. Having it switch to the group and change the sort order is easy to do.
I am not entirely sure I can visualize in my head what you mean here. If that’s the way to have the sort order apply to selected groups, sure. But I understood correctly that this would mean to only have one image group selected at a time?
If that’s the case I think it would be better to apply it to the whole collection at once if that’s possible and okay performance-wise.