Skip to main content
Known Participant
June 10, 2016
Question

Applying a 3D LUT file with Color Lookup adjustment layer

  • June 10, 2016
  • 3 replies
  • 7739 views

Hi,

We are looking for a way to automatically apply a given 3D LUT file (.cube file) loaded into a Color Lookup adjustment layer to an open document. By using the Action Manager and the ScriptListener plug-in, we have managed to create a Color Lookup adjustment layer but we are getting some troubles for loading and applying the LUT to the document. We have analyzed the script code recorded by ScriptListener and did a few tests to try troubleshooting this step but we are a bit confused on how the color table data is being stored in the Color Lookup adjustment layer. Does it create a color profile? Or a curve? How can we convert those values in JScript to eventually get the LUT working properly?

Hoping to get some info to help on this!

Thanks

3 replies

Participating Frequently
March 11, 2017

Anybody got better chance with this ? I'm wondering if there are any progress on this question as on my side, it feels like a blocker.

Cheers

Participant
July 23, 2019

Hey guys Did anyone end up finding a solution to load up any lut using JSX?

Participating Frequently
June 18, 2016

Hi guys,

I want to resume a little bit as inside the scriptListener record, there are two big data, seems to be used. Don't really know exactly  what they are... We figured about the second one, which seems to be a UNICODE translation of the .cube file.

So I checked for the first data, precisely this line on the ScriptListener:

desc5.putData(stringIDToTypeID( "profile" ), String.fromCharCode( 00000000......values)

and more specifically about this part: stringIDToTypeID( "profile" ). This seems to be the color profile of the document, embedded inside of the psd.

You can call yours with theses lines of javascript: (Source)

try{

var profile = app.activeDocument.colorProfileName;

}catch(e){

var profile = "not embedded";

}

$.write(profile);

So far, I'm at work... and the one used here is: sRGB IEC61966-2.1

I will try at home. but will be interested about yours... When theses values may change ?

--------------------------------

For what I understand, to apply a lut, you need first a profile, regarding your colorSpace env (think about an IPAD - screen projector or CRT monitor), do some math with your LUT data... and this make the lut as globally possible.

This is new to me.. If someone have more knowledge about this and would love to confirm it or simply say it's totally wrong...!!

PLEASE flag it.

Just a wiki page to remember what is what : Wiki

Thx,

Romain

Known Participant
June 23, 2016

I did some tests and to me, the desc.putData( idprofile, String.fromCharCode( values ) ) seems to create a color profile from the color table data while the desc.putData( idLUTthreeDFileData, String.fromCharCode( values ) ) will store the color table data.

Even though I'm still not quite sure about this but that would be my guess.

Participant
November 9, 2016

I have the same issue, and have concluded the the (binary) profile data is a processed version of the LUT, which means that unless we can create this binary data ourselves (i.e., Adobe publishes the format of the data), it won't be possible to create a script that loads an arbitrary LUT from disk.

If you've figured out a solution to this problem, I'd love to know about it! Thanks!

SuperMerlin
Inspiring
June 10, 2016

It is possible to get the code for the cube file, but it looks as if you need to get the code for each cube file you want.

For me the ONLY time I can get the cube code is after a fresh start of the machine.

Then create your lookup, you should then have the code in the log.

Example code can be downloaded. Wikisend: free file sharing service

This is from CS6 on Windows.

P.S. create your lookup layer before running the code.

function colorLookup() {

var desc79 = new ActionDescriptor();

var ref40 = new ActionReference();

ref40.putClass( charIDToTypeID('AdjL') );

desc79.putReference( charIDToTypeID('null'), ref40 );

var desc80 = new ActionDescriptor();

desc80.putClass( charIDToTypeID('Type'), stringIDToTypeID('colorLookup') );

desc79.putObject( charIDToTypeID('Usng'), charIDToTypeID('AdjL'), desc80 );

try{

executeAction( charIDToTypeID('Mk  '), desc79, DialogModes.NO );

}catch(e){}

};

Good luck.

Known Participant
June 13, 2016

Hi SuperMerlin,

Thank you for your response, but I'm a bit confused here as the example code file seems to be damaged first and then because the colorLookup function creates a Color Lookup adjustment layer only, and like I said, we have already figured out how to do this.

What we are still missing is how we can convert the values from the 3D LUT file to create the color profile or curves in the Color Lookup adjustment layer, actually I'm not quite sure how this works in the background and that's the reason why I'm still looking for answers to get it.

Can you send me your example code again so I can take a look at it?

Thanks,

Jeremy

SuperMerlin
Inspiring
June 14, 2016

I have amended the sample to create the lookup layer and apply the NightFromDay.cube

Wikisend: free file sharing service

Once you get code from scriptListener there are two line where the path to the cube file is located, these are not required.

You will see I have commented these out in the NightFromDay cube example.