Page 1 of 1

Request for LUT file support (.cube, .lut, .3dl..)

Posted: 2018-11-24T23:17:04-07:00
by B4adle7
Upon asking if Imagemagick supported .cube files yet, it was suggested to come here and post to ask for the feature request.

Feature Request: Support for 1D/3D LUT (Look Up Table) files. e.g. .cube, .lut, .3dl.
https://en.wikipedia.org/wiki/3D_lookup_table
https://wwwimages2.adobe.com/content/da ... on-1.0.pdf

Imagemagick supports CDL data (-cdl <cdl file>). It also supports CLUT as HALD files. (-clut <hald .png>)

Aside from needing to convert a LUT file into a HALD image with the specified LUT, it generally does the trick.

However for a while now, have been running into more and more instances where color conversions seem to be done while wearing boxing gloves.
Getting images that are being pushed into the negatives and/or pushed color values well over 1.0 before then getting the counter-part CDL or LUT that brings the colors back into 0.0-1.0 range.

Granted, I have not attempted using an .exr as a HALD yet, will give it a try. Also ham-fisting color conversions would not be IMDev's problem.
But the use of PNG HALDs now truncate the data, since it cannot record color values below 0.0 or above 1.0. Especially clipping the top before applying the associated color transform really shows up.

Again, this might be cured by using an alternate image format.
However is it possible to request the support of some of the most standard LUT files? I believe .cube is the most prolific format.
It would be wonderful to hear whether this was a worthy consideration for a feature. (or to smack me on the head to tell me already done.)

Re: Request for LUT file support (.cube, .lut, .3dl..)

Posted: 2018-11-25T10:54:03-07:00
by magick
Grab the latest source repo from Git. It supports .cube:

Code: Select all

identify -verbose cube:FG_CineBasic.cube
We still need to support certain keywords and we don't support write just yet.

Re: Request for LUT file support (.cube, .lut, .3dl..)

Posted: 2018-11-25T15:02:10-07:00
by fmw42
So ImageMagick in IM 7.0.8.15(beta) can do the above for a 3D lut. That is it can read the cube file. But the docs at https://wwwimages2.adobe.com/content/da ... on-1.0.pdf, which explain how to read the file, do not seem to explain how one applies the 3D Lut to an image. Does anyone know or have a reference that explains how it is applied and especially one that has code?

Re: Request for LUT file support (.cube, .lut, .3dl..)

Posted: 2018-11-25T18:40:03-07:00
by fmw42
This may be useful to those who code. https://stackoverflow.com/questions/249 ... 6#25252446

Also see http://opensource.mikrosimage.eu/ColorP ... UT_to_LUT/

This seems to imply that G'MIC can convert a .cube lut to a halt lut. That seems like a possible way to go here for ImageMagick.

Past discussion is at https://imagemagick.org/discourse-serve ... hp?t=22252

Re: Request for LUT file support (.cube, .lut, .3dl..)

Posted: 2020-01-22T13:02:07-07:00
by fmw42
magick wrote:
2018-11-25T10:54:03-07:00
Grab the latest source repo from Git. It supports .cube:

Code: Select all

identify -verbose cube:FG_CineBasic.cube
We still need to support certain keywords and we don't support write just yet.
What ever happened with the cube format? Can it be used to process and image similar to -hald-clut? It seems from above that all you can do is look at its values. Can it be converted to a HALD format image?

I only find the following in the documentation:
CUBE R Cube Color lookup table converted to a HALD image Select levels like this: cube:Vibrant.cube[8] for level 8
So how does one take a cube LUT and use it to process an image in ImageMagick?

Re: Request for LUT file support (.cube, .lut, .3dl..)

Posted: 2020-01-26T06:16:57-07:00
by magick
ImageMagick reads the CUBE image format and automagically converts it to a HALD image with interpolation.

Re: Request for LUT file support (.cube, .lut, .3dl..)

Posted: 2020-01-26T12:28:46-07:00
by fmw42
magick wrote:
2020-01-26T06:16:57-07:00
ImageMagick reads the CUBE image format and automagically converts it to a HALD image with interpolation.
Sorry, that is not totally clear to me. How does this happen? What is the command to convert it?

Code: Select all

convert CUBE:file.cube HALD:8
If not the above, then would you give an example syntax.

Re: Request for LUT file support (.cube, .lut, .3dl..)

Posted: 2020-01-26T15:18:46-07:00
by magick
CUBE is a read-only format. It reads the file.cube and converts it to a HALD image. Try converting from CUBE to PNG to visualize the results.