Exporting Styles as haldCLUTs

Hey everyone! I’ve created a lua script which allows users to export their styles as haldCLUTs. The script can be found here. To use the script place it in the lua/contrib folder of your darktable installation and add require "exportLut" to .config/darktable/luarc. If everything is working correctly a “export haldclut” module should appear on the right panel of the lighttable.

Usage

  1. Select the identity haldclut. You’ll most likely want this one.
  2. Select a folder to output the generated haldCLUTs to
  3. Press export

This will generate haldCLUTs for all user styles currently in the database.

Current Limitations

  • If a file already exists in the output folder with the same name as the generated LUT the file will be silently overwritten. Unfortunately after looking at the lua API documentation it doesn’t appear as though there is a way to specify how to handle naming collisions when exporting images with a lua script.
  • All styles are exported as LUTs. Given the widgets provided by the lua API I didn’t see a good way to select specific styles. Open to suggestions though!
  • Styles which apply cropping, rotation, or any other manipulations not limited to global colour or lightness changes will likely produce a broken LUT. The lua API doesn’t appear to provide a way to inspect styles are see what edits each style makes.
  • Less of an issue with the script and more of a consequence of the pixel pipe in darktable: depending on modules used in the style when applying generated LUTs to an image it may be necessary to move to lut 3D module in the pixel pipe to obtain the expected results. More info about this here.

This is my first attempt at writing lua scripts for darktable (or lua at all :upside_down_face:) so i’ve likely misunderstood some things about the lua API or made some oversights. Any feedback would be appreciated.

3 Likes

Thanks for sharing and welcome!

1 Like