3D LUT module in darktable 2.7 (dev)

(ph. weyland) #1

A way to apply 3D LUT in dt is introduced with the module lut3d.


A 3D lut is a tridimensional table which allows to transform any rgb value into another rgb value.
This transform is very rigid (you cannot tune the effect apart with blending) but it’s a quick way to apply a colour effect (film-emulation) to an image.

3d LUT files

The module accepts cube and haldclut files.
Cube files are used for video editors. They are text files with the cube extension. You can find such files through this link:

Haldclut files are used in G’MIC, RT, photoflow. The are usually coded as a png image. Here are some places to find them:

Caution: before selecting a 3D lut file, you must define the root folder where you have stored the lut files, in preferences / core options / miscellaneous.

Note: due to the size of the lut, lut data are not saved with the parameters of the image. Instead the file path (inside the root folder) is saved. Then you need to backup properly the lut files (+ folders) you have used.

Color space

Each 3D lut is built to be applied on a given color space. lut3d lets you select the appropriated one.

Usually cube files are built for REC.709 and haldclut for sRGB.

Note: This works when lut3d module is placed between input color profile and output color profile. Otherwise the selected color profile is ignored, and the lut is applied on the work profile.


The RGB cube defined by the lut file is characterised by its dimensions (ie. the size of the cube). It’s always below 256.
The largest it is, the most accurate is the transform. But it takes also more time to decode the file and consumes more memory.
The smallest it is, the fastest the module is. And here you might see some effect of the interpolation method (to calculate colours which are not exactly on a node of the cube).

There are three interpolation methods available: tetrahedral (the default one), trilinear and pyramid.

Usually haldclut cubes are larger than cube cubes.


WOW. Works fine.

(David) #3

It works really nice!,
Thanks a lot for your time and energy into this.


Thank you!
When in the pipeline it shall be enabled? Does it matter?

(Jean-Paul) #5

Thank you for this new module and sharing it. It works great, I have the impression that the B/W conversions with HaldCLUT.png are more subtle than those in the manual. I saw that there is a GitHub to convert HaldCLUT.png to.cube: https://github.com/mikeboers/LUT-Convert

It reminds me of the abandoned HaldCLUT branch.



freshLUTs is the world’s largest collection of free LUTs. You can browse and download any LUT you like. You can also add LUTs to your favorites and keep track of all the LUTs you downloaded. Filmmakers can upload their LUTs here and share it with the world.

(Jean-Paul) #7

Thank you for sharing. I just looked at the size of the.cube I produced. They are much heavier than the HaldCLUT.pgn that I used to generate them.

(ph. weyland) #8

Yes, that’s exactly where I started from.

Well, depends on what you want to achieve and on the type of lut you use.
I would say (but I’m not expert for this) that for film look usage it should be close to the latest (before colour out). Keep also in mind that lut transform is usually not linear and therefore can break the colour accuracy of your image.

Transforming an haldclut file to cube file is interesting when your application doesn’t read haldclut. Otherwise it seems better to keep the haldclut one (more compact for the same amount of data).
NB: there are 8 bits and 16 bits png haldclut files. 16 bits haldclut are more accurate, but only if they have not been derived from 8 bits ones.

It’s fair to say that working on this was a great opportunity for me to learn about dt, reading the code from other authors, copying it, answering the reviewers’ questions and listening to testers’ guidance. A big thanks to all of them.


I cannot wait to experience this module. Thanks a lot also from my side.

A little OT and newbie question…

Is there an easy way to do this multi-replies? I only see that full quote button…

(ph. weyland) #10

Great source !


In the gamma category, most of the values are not applicable in dt, especially the log ones.
The log colour profiles are camera manufacturers’ raw profiles. To take advantage of them we would have to make dt able to treat them as a raw profile (before color input module).

EDIT: see log and hdr explanations by Sony https://helpguide.sony.net/di/pp/v1/en/print.pdf

1 Like
(ph. weyland) #11

You select the piece of text you want to reply to. A Quote overlay does appear just above your selection. Clicking on it adds the quote to your current message.
I hope that answer the question…


It does!
Thank you very much!


(Pascal Obry) #13

BTW, Philippe maybe you could write a text for the darktable blog?

See for example : https://www.darktable.org/blog/

1 Like

@phweyland perhaps you could use the G’MIC CLUT compression

1 Like
(ph. weyland) #15

Impressive! It claims to achieve 99% compression !!.
G’MIC provides already some tools to compress and uncompress the lut files.

The @jpg comment is more text cube file related which is bigger than equivalent png file, by nature.

But the interesting news here it that, with a 99% compression rate, it could turn possible to store the lut (compressed) data along with the image’s dev parameters (instead of keeping only the file name).

For reference https://hal.archives-ouvertes.fr/hal-02066484v3/document

(G'MIC staff) #16

I’d gladly share the decompression code (in C++) for integration into any free software that needs this feature :wink: https://framagit.org/dtschump/libclut

(ph. weyland) #17

That sounds great !
Is there any convention already defined to distinguish a compressed haldclut from an uncompressed one ? Or is there an automatic way to know that a png haldclut is compressed ?

(G'MIC staff) #18

I don’t have non-compressed HaldCLUTs anymore in G’MIC, so all CLUTs available in G’MIC are compressed this way.

(ph. weyland) #19

Something to be integrated into your dt 2.8 presentation (as there is for each new module for dt 2.6), is that what you think about ?

(Pascal Obry) #20

Indeed there will be a need for documentation for this module.

But I was also thinking about a blog post to show what could be done with this new module. As an example see this blog post:

This is more a communication to advertise the new features.