lua-scripts icon indicating copy to clipboard operation
lua-scripts copied to clipboard

Add custom format variables

Open bczhc opened this issue 5 months ago • 1 comments

Seems I can't find a way to add custom format variables, for example, for the image exposure value (not the 'bias') calculated by the formula $$\log_2{(100N^2/(\rm{ISO}\cdot S))}$$, I could add a variable called $(EV_AT_ISO100) and use it in lighttable tooltip/overlay text formatting textbox. Or, can I modify the overlay text directly in lua scripts?

bczhc avatar Jun 20 '25 22:06 bczhc

The overlay text is not accessible from Lua at the current time.

Lua does support almost all of the substitution variables supported by darktable, but it is a separate functionality contained in the Lua scripts string library and is not used by the darktable variable substitutions.

wpferguson avatar Jun 21 '25 20:06 wpferguson

I figured out a way to do this...

You could calculate the exposure value for the image. You could create a tag metadata|exposure value|<value>, where <value> would be the computed value and then attach it to the image. You could then use the tag in the variable substitution with $(CATEGORY[0,"metadata|exposure value"])

You could script it checking to see if the tag exists and if not creating and adding it.


I'm trying to figure out a way for the user to add additional metadata fields that they want monitored and available to use, The above solution with tags is probably the way I'm going to go.

wpferguson avatar Dec 01 '25 19:12 wpferguson