scripting module parametrization and masking

Is there a way to automate adding and programatically parametrizing a module and its mask in Darktable, eg with Lua scripting?

To make the example concrete, consider vignetting. I would like to have a way

  1. adding an exposure module,
  2. with an elliptical mask that is aligned at the center, maybe leaving 1/6 of the width & height untouched along the edges,
  3. with something like -0.5EV.

I know that I can do this manually, and I can also use presets for the module parameters. But not for the mask, since it is different for each image.

But the question is more general; there are lots of cases where I would love to write a simple script to do some calculations and add a module, or a bunch of modules to the pipeline based on the results.

Is this possible? How?

Yes

darktable.gui.action()

:grin:

The real solution is a combination of presets, styles, and scripts.

For instance:

I have a colorbalancergb preset I named “My Color”. I normally apply it to my sports images.

I created a style called “Starting Point Contrast” that contains 4 instances of diffuse or sharpen, a couple of tone equalizers, the above mentioned colorbalancergb, all arranged in the order I want. The additional modules are all turned off.

My workflow is cull, then apply the style to the selected images. I open them in darkroom, straighten, crop, exposure adjust, then hit a keystroke shortcut that turns on the appropriate modules based on the image settings. For instance, I check the ISO and apply denoising based on the value (low values get denoise_profiled, higher ones get additional diffuse or sharpen denoise settings applied). After that I do a slight exposure adjust if needed and move on to the next image. If I had a really good shooting day (things are straight and well exposed), I can process images in just a few seconds. My normal editing session is 100+ images and this has allowed me to go from hours to usually less than an hour.

Mask manipulation might be an issue. I think you might be able to manipulate a mask using the mask manager, though you might have to create it with a preset on the module you want to mask.

1 Like