Applying Color Lookup Tables from ICC file?

Does anyone know if it is possible in UXP to apply a color lookup table from an ICC file? What I would like to do is have some ICC files in the plugin folder and use UXP to apply them.

I tested recording an action to apply a local ICC lookup table file. Then using the “copy as javascript”, the UXP code has the ICC data in it which is very large. It works but the data string is very large, depending on how many grid points the ICC file contians.

For a 64 point grid ICC is it around 2MB of string data in javascript variable. I can’t get a 256 grid point action itself to even work… but the ICC files are 100MB for a 256 point ICC so that is too large to want to use anyway.

The embedded data method would be great if the data was not so large in the JS file. Therefore, having it load from the ICC file would be best.

A 32 grid point is only around 200KB of data so right now that is the best option to use that embedded in the JS. It make a huge variable string but is at least manageable is the JS file.

However, I would really like to use ICC files with 64 grid points and not have the 2MB data per ICC embedded in the JS if possible.

What would be ideal would be to have a UXP getter for the Color Table, but that doesn’t seem to be accessible either. :slightly_frowning_face:

@svumme did some work on LUTs, but I don’t think it was around ICC files, IIRC.
(Cc’ing them just in case :slight_smile: )

You can try the followung function (the active Layer has to be a color lookup layer):

async function setICCData(lutName, base64Data){
    const cmd = {
        _obj: "set",
        _target: [
                _ref: "adjustmentLayer",
                _enum: "ordinal",
                _value: "targetEnum"
        to: {
            _obj: "colorLookup",
            lookupType: {
                _enum: "colorLookupType",
                _value: "deviceLinkProfile"
            name: lutName,
            profile: {
                _rawData: "base64",
                _data: base64Data


    await batchPlay([cmd],{ "synchronousExecution": true });

The important thing is, that the variable base64Data must contain the ICC profile data in Base64 encoded format. Thus you can write some code which reads the ICC file from the file system and converts it to a base64 encoded string.
Of course, ince you are modifying the actual document, everything must be wrapped into "“executeAsModal”.

Actually, I think your solution will work without needing to include coding to convert to base64 :slight_smile:

Using “export as javacript” from a Photoshop action will already give the base64 variable. So first, actions can be recorded to apply the LUTs. Then the base64 vars can re retrieved from the actions and stored as plain .txt files.

So each base64 variable could be stored as a text file. Then the plugin could read the .txt files to get the variables for the different LUTs as needed.

Of course you can do so — if there is only a small fixed set of LUTs. However, even in this case I would consider using some tool which converts binary files (e.g. *.icc) into base-64 encoded text files.