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

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
B4adle7
Posts: 11
Joined: 2018-06-10T10:25:40-07:00
Authentication code: 1152

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

Post by B4adle7 » 2018-11-24T23:17:04-07:00

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.)

User avatar
magick
Site Admin
Posts: 10909
Joined: 2003-05-31T11:32:55-07:00

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

Post by magick » 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.

User avatar
fmw42
Posts: 24473
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post by fmw42 » 2018-11-25T15:02:10-07:00

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?

User avatar
fmw42
Posts: 24473
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post by fmw42 » 2018-11-25T18:40:03-07:00

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

Post Reply