Working with modules from Lua scripts in darktable

Hi @priort and @wpferguson ,

there is a new version of my script, you can find it attached. In the end, this script executes some automatic functions that can also be accessed via the GUI (click the magic wands).

With Darktable 4.2, this script has been accelerated. It uses the new “pixelpipe-processing-complete event”. It should be about twice as fast (less thread.sleep()).

From now, the white balance is only adjusted by default for the modern workflow of Darktable. The script distinguishes between modern and legacy workflow and keeps white balance unchanged by default, if using legacy workflow.

It was a little bit difficult to figure out how to do this: dt.preferences.read(“darktable”, “plugins/darkroom/chromatic-adaptation”, “string”). The documenation points to another way: “The name of the preference displayed in the preference screen”, I assumed “auto-apply chromatic adaptation defaults”.

I am looking forward to your comments :slight_smile:

InitialWorkflowModule.zip (4.9 KB)

Best Regards,
Uli.

by the way: Many thanks to all developers of DT! For me it is one of the most exciting software projects and I am very happy that DT exists! It’s open source, it runs on Linux, it’s always evolving, it can be automated and so on - and I have nicer pictures :slight_smile: . Thank you very much!

6 Likes

@Claes there is a new version of my script, perhaps this can be helpful.

Best Regards,
Uli.

Danke vielmals :slight_smile:

Thanks for sharing. I have promoted it a few times and shown a screen shot of the layout…I get back hey what module is that, what version of DT are you running… :slight_smile:

I must say I have not put it to good use yet as I have been really busy at work and have really not had any photo’s to edit but I will install this new one and check it out… I will do a few tests… I think you pointed me to that function in our initial discussion and I had made the change so maybe I won’t notice that 2x bump but never the less thanks it really shows what is possible…

I think one nice addition if you can figure it out would be to set the auto pickers for the rgb CB module mask… the white fulcrum and contrast grey to set up the mask for the tonal ranges…

image

2 Likes

Hi @priort , thank you for the promotion :slight_smile:

Yes, that is based on the start of the discussion and the new event you implemented. This is very useful. Performance is already “normal” for you as developer, so you won’t see any gain in performance.

You propose an extension for the color calibration module. I’ll look at that in two weeks after my vacation, that should be easy to do.

Best regards,
Uli.

This is awesome news! That’s exactly what I was looking for last year!

I wonder what kind of “dynamic preset” shenanigans we can come up with, with this capability. Most of my immediate ideas would involve some sort of measurements, though. I could probably fake an approximate exposure estimate by, say, enabling the auto mask exposure compensation in the tone equalizer, and then reading the mask exposure compensation value.

Or is it possible to place/read color pickers? One could even imagine placing several pickers over various image parts, to do weighted exposure evaluations. Information about under- or overexposed areas might also be useful…

I can’t wait to play with this!

It runs the exposure auto picker which by default is 50 percent that works a lot of the time but you could adjust it if not…

Happy New Year…

Given this topic a way of working in whether to use filmic or sigmoid when running the script might be of interest to many as well…

1 Like

Some of the latest code seems to have broken your script… it seems to cycle through multiple times. I even saw the local contrast module appear and then disappear??

Just built for the first time after the multiple auto presets for the same module code has been added. I wonder if that might be part of the issue?? Also there are new options in processing preferences to denote the default workflow…

Hi @priort ,

I am running DT4.2 on Linux (EndeavourOs) for my daily work. So I’m not using the latest developer version. I will execute the script in a virtual machine with the newest Arch / EndeavourOs version.

In the last few days I’ve made some changes locally. However, the script still does not use the local contrast module, the ID “iop/bilat” is not found in the code.

So maybe it really has something to do with the latest build?

Did you use “darktabe -d lua”? This will output some logs. Does the script run in a loop?

Best regards,
Uli.

Yes it seemed to run in a loop sometimes it looked like 4 or 5 times and in the end but not always often did land with the right adjustments and other times not…

The have changed the workflow settings in preferences now… There is single preference with 4 options… none sigmoid filmic basecurve… There are no settings now for wb. So the only way to get legacy wb by default read from the camera is to set this to none… You can then add an auto preset for filmic but it will not update rel white and black so your script will come in handy for those wanting to keep using legacy wb as a default… also the multiple auto presets/module and auto renaming might also interact with your script on some level but I don’t have the knowledge to say for sure…

1 Like

Hi,

I tried to execute the script in a virtual machine with the newest Arch / EndeavourOs version, but no packages are available. Do you know, when Darktable 4.3 will be available in Arch (AUR)?

Is there another way, to execute DT 4.3?

BR,
Uli.

I guess you would just have to build it… not too hard but maybe not worth fiddling… none of these would work for you I don’t think . I don’t know that much about Arch…

There should be a darktable-git package in the AUR AUR (en) - darktable-git

yes, but it was last updated on 2022-10-25 for DT4.1, not DT4.3.

This is an excellent script. Thanks for posting. This makes my workflow much faster.

The only module I add on top of the ones that are already included is local contrast. I wouldn’t mind playing around with the script myself, but I found no documentation about the commands required to invoke the local contrast module in a LUA script and change its settings.

Hi @Sciencenerd ,

thank you very much.

Using Darktable 4.2 you can get the lua command in this way: Follow

https://darktable-org.github.io/dtdocs/en/preferences-settings/shortcuts/

and click on the small icon in the top panel as described in “assigning shortcuts to actions”. You enter visual shortcut mapping mode. Point to the local contrast module. Within the popup you can read the lua command.

Best Regards,
Uli.

2 Likes

Hi @Sciencenerd,

do you want to set any local contrast options by default? I am extending the script and could add it.

Uli.

1 Like

Hi Uli,

Thanks for the tip, that worked. Would have never figured out that local contrast is invoked using the “bilat” command. I usually use the local laplacian filter with the clarity preset with detail tweaked to 200% and midtone range 0.4 to 0.45.

Hopefully, I’ll have some time over the weekend to give it a try.

Thanks again, and I think your script would be a great starting point for ANY beginner who finds Darktable difficult to get into (that was me last year at this time).

BTW: Are you a fellow German?

Chris

Hi Chris,

BTW: Ja, aus Bielefeld :slight_smile:

Gruß,
Uli.

1 Like