7

In darktable's lighttable I can export JPEGs from my raw pictures and specify a max width and height. If I need multiple versions of a raw picture, e.g. sky.dng exported with 3840x2160/1920x1080/960x540 as sky_3840x2160.jpeg etc., I need to insert the different width/height manually.

Is there a way to export multiple versions with just different sizes at once?

  • Your best bet may be to instead run a batch script (using ImageMagick or similar) on an output directory full of largest export. This would give you more control over sharpening per each resize, etc. – junkyardsparkle Feb 3 '17 at 20:13
5

It's easy enough to do in a shell script using the commad-line interface:

#!/bin/sh
for FILE in file1 file2 file3
do
    for SIZE in 640 800 1280
    do
        darktable-cli "${FILE}.nef" "${FILE}.xmp" \
            "${FILE}-${SIZE}.jpg" \
            --width "${SIZE}" --height "${SIZE}" --hiq true
    done
done

This is pretty close to verbatim from one of the custom programs that's part of my workflow.

  • Great answer, thanks! Not sure if it's just a typo or if previous versions of darktable used a different name for the flag, but --hiq on my system throws an error; --hq works (and is set to true by default). – Kahovius May 11 at 16:33
2

If you're comfortable enough with the command-line or lua, then use one of the answers suggesting scripting.

Otherwise, a semi-automatic way to do this is to create one preset for each size in the "export selected" module in the lighttable:

  • Set the size in the "global options" part

  • Hardcode the size in the file name field

  • Click on the three-dash icon and select "store new preset"

Then, to export with multiple sizes, select one preset, export, select another, export, ...

0

You might be able to do this by scripting it with lua

  • 4
    Can you please extend your answer, give some examples – Romeo Ninov Feb 3 '17 at 12:05
0

I'd like to extend a bit on the other answer. It is possible to extend darktable due to its integrated Lua scripting language. That way, it is possible to write “plugin” like extensions. The nice thing about it is that darktable has not to be recompiled to make use of new scripts, what would be needed if darktables code itself is touched. While not everything within darktable is accessible via scripting, I can imagine several ways of solving this issue with Lua, but I am not a programmer and cannot solve this issue in a reasonable amount of time. The first one would be to add a new storage backend which would be visible in the export module as a new target. With this method, complex things are possible, see e.g. this video of Harry Durgin explaining such a plugin which is available from the scripts github (it could serve as code example if you decide to go this route). Another method would be to call an external program such as imagemagick from Lua after export, that resizes the image. This could be triggered e.g. by a shortcut key press, but it would be much more limited. Best would be, if you get in touch with the darktable community either via mailing list or IRC (chat) or by posting a feature request on the project's issue tracker (check before if it is not already filed).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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