export photos with darktable-cli

I need to make a bash script which loads each raw image in a folder and exports it with a given export preset. The photos are already “developed” with darktable.

Is it possible using darktable-cli?


Have you tried > man darktable-cli (or looked in the manual)?
Or do you need help with the bash part?

I need help with darktable-cli, the documentation is very essential.

The only clue I see is:

output file
The name of the output file. darktable derives the export file format from the file extension. You can also use all the variables available in darktable’s export module in the output filename.

For me it’s quite obscure: what does You can also use all the variables available in darktable's export module in the output filename mean?

No example is given, neither in the manual, nor in other sites.

Wouldn’t those be the variables described in the manual (special topics/variables)? You may have to protect the ‘$’ sign with a backslash so bash won’t gobble it up (and give an error message), like this: “\$(day)

Wouldn’t those be the variables described in the manual (special topics/variables)?

I intend that the variables available in darktable's export module has a different meaning. And anyway in that list there isn’t any option for the export module

I do not think its possible to use export module settings at the CLI. Put all settings necessary into an xmp and use that.

I do not think its possible to use export module settings at the CLI.

Actually it works!


Darktable 4.0 documentation now explains how to specify the format parameters

Hi’ @Paolo_Benvenuto
I hope that you can help me to get cli to work. I’m trying to develop the raw files (without xmp files) in the input directory and put the output in the output directory

The following command (with or without --out-ext jpg):

Start C:“Program Files”\darktable\bin\darktable-cli C:\foto\DT.develop.in C:\foto\DT.develop.out --out-ext jpg

results in the error shown below. What is wrong?

I’m seeing you are on windows, I’m on linux

For me a command like yours works.

Please test if issuing the command with the xmp file already generated (simply open darktable and import the photos) changes anything

Same result with xmp files in the input library.
Does this prove that 3.8.1 cli doesn’t work on windows?
I have reported this problem earlier and uploaded the error log but without any response….

The application created a backtrace when it crashed. This file may contain valuable information about the cause of the crash. It’s a text file, just open it with a text editor and read…

If you did not receive an answer, probably no one could reproduce your problem.

Darktable cli fails with this error message (from a previous attempt to make cli work):

darktable-cli.exe caused an Access Violation at location 00007FFF31866C21 in module libdarktable.dll Reading from location 0000000000000000.

What to do now? I upload the full error log.

darktable_errorlog.txt (8.1 KB)

I don’t have time to try but are you not missing a \ after C: and maybe try Program_Files… If it is syntax and to make it easy put the darktable bin folder in your path then you can just use the command for darktable-cli directly…

I have no issues when I have used it on WIndows but it has not been for some time…

The backslash disappeared creating the post, sorry about that! It isn’t missing in the BAT file.

Bottom line is that

start C:“Program Files”\darktable\bin\darktable-cli C:\foto\DT.develop.in C:\foto\DT.develop.out

causes an exception, but RT works fine using a similar command:

start C:“Program Files”\RawTherapee\releases-win64-5.7\rawtherapee-cli -o C:\foto\RT.develop.out -d -c C:\foto\RT.develop.in

Maybe you could try cli on your windows system……:grinning:?

I discarded windows 10 years ago, for good reason … :wink:

To get detailed debug information on the console you could try

start C:\“Program Files”\darktable\bin\darktable-cli C:\foto\DT.develop.in C:\foto\DT.develop.out --core -d all

I do use it for performance testing opencl configurations and it works fine…I haven’t for a month or so but I am on Win11 and usually have a build no more than a couple weeks old…about a month ago I used it quite a bit tweaking and testing opencl parameters …

Maybe wait for v4 out in days and see if you still have that issue…or download Bills WIndows Insider from last Sunday…it will essentially be v4 and see how that functions??

Ok. Thanks, I will wait for v4.

I just noticed that the PX interface “eats” the first backslash in every input line??? See below.

When you’re putting in program code, you need to format it properly. Otherwise it gets interpreted at markdown.