manu-mannattil / clut2dtstyle

A script for converting Hald CLUTs to darktable style files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This script is obsolete as darktable now (since version 3.0.0) has a module for 3D RGB LUT transformations that natively supports Hald CLUTs and Cube files.

clut2dtstyle

clut2dtstyle is a Python script to convert color lookup tables (CLUTs) in the form of Hald CLUTs (used by RawTherapee, digiKam, etc.) to a darktable compatible style file. It requires darktable and ImageMagick (for convert and identify).

Usage

Since darktable only supports CLUTs with at most 49 patches, the conversion will be approximate (but reasonable). Although Hald CLUTs are usually distributed as PNGs, clut2dtstyle will also work with CLUTs in other lossless formats.

Existing Hald CLUT

If you already have a Hald CLUT you want to convert to a darktable style file, you can use clut2dtstyle directly (with additional options):

clut2dtstyle              \
  --number 50             \
  --output preset.dtstyle \
  --patches 40            \
  --title 'Preset Name'   \
  preset.png

Note that using a large number of sampling points results in a large computation time. Since darktable-chart does not support more that 49 patches in the output CLUT, doing this will not result in a better fit.

Cloning a filter

If you wish to "clone" a certain filter or style (e.g., one applied by an external program), use ImageMagick to generate a neutral Hald CLUT first:

convert hald:4 hald4.png
# apply external filter on hald4.png and save to output.png
clut2dtstyle output.png

If the program applying the filter produces only lossy output (e.g., as a JPEG file), it is better to scale up the neutral Hald CLUT before applying the filter:

convert hald:4 -scale 1000x1000 hald4.png
# apply external filter on hald4.png and save to output.jpg
convert -scale 64x64 output.jpg output.png
clut2dtstyle output.png

Again, since the number of patches in the output CLUT is limited, it does not make much sense to go beyond a level-4 CLUT for cloning a filter.

Example

License

Public domain. See the file UNLICENSE for more details.

About

A script for converting Hald CLUTs to darktable style files

License:The Unlicense


Languages

Language:Python 100.0%