Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

ExtendScript Error When Creating Color Lookup Layer ("Program Error")

Community Beginner ,
Sep 21, 2025 Sep 21, 2025

Hello everyone,

I'm writing a Photoshop script (ExtendScript/JSX) to automate a color grading workflow. The intended sequence is:

Merge all visible layers into a new layer.

Create a new "Color Lookup" adjustment layer, loading a specific 3D LUT file.

Merge the Color Lookup layer down onto the merged layer.

My script fails at step 2, when attempting to create the Color Lookup layer, and returns the following error message:

"Error: A general Photoshop error occurred. This functionality may not be available in this version of Photoshop. -Could not complete the command because of a program error.

Is there a different, more compatible scripting method to create a Color Lookup layer while simultaneously loading a 3D LUT file?

Thank you in advance for any help or advice you can offer!

TOPICS
Actions and scripting , Windows
191
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Expert , Sep 22, 2025 Sep 22, 2025

Forgetting adjustment layers, I successfully tested the direct application of one of the default LUTs from Adobe via the AM code recordered by the SL plugin. It's verbose as it captures the entire lookup table, but it works.

Translate
Community Expert , Sep 27, 2025 Sep 27, 2025

I have attached the code as a .txt file, as it contains over 6K lines. I have made the reference to the 3D LUT cross platform, the rest of the code is verbatim SL recorded. This example uses the default adobe "Candlelight" preset and is for direct application to a raster layer (not adjustment layer).

Translate
Adobe
Community Expert ,
Sep 22, 2025 Sep 22, 2025

Is it a LUT, ICC or DeviceLink?

 

Why not directly edit the merged duplicate layer (Image > Adjust), as the adjustment layer isn't being used non-destructively, so it just adds more steps. And perhaps complexity?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 22, 2025 Sep 22, 2025

It's LUT.
I'm developing a plugin, and this is one of the steps. This is a custom LUT file, and I want the operation to be simple enough, just like some filter plugins, where you can click on an effect and it will be applied directly to the image. I'm not a professional developer, so maybe there's a better way?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 22, 2025 Sep 22, 2025

Do you have the ScriptingListener plugin installed?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 22, 2025 Sep 22, 2025

I've tried using the command code from ScriptingListener that I executed, but for some reason, it only works up to the point of creating the Color Lookup adjustment layer. When it tries to apply the cube file to the target path, it gives an "Error 8800." I've also tried using XTools' Action to JavaScript. It works fine for converting other actions, but as soon as I try to convert the action I mentioned above, Photoshop freezes and gets stuck in a loop. Here is my test code

quote

#target photoshop
app.bringToFront();

function applyCubeLut() {
// =======================================================
var idMk = charIDToTypeID("Mk ");
var desc1 = new ActionDescriptor();
var idnull = charIDToTypeID("null");
var ref1 = new ActionReference();
var idAdjL = charIDToTypeID("AdjL");
ref1.putClass(idAdjL);
desc1.putReference(idnull, ref1);
var idUsng = charIDToTypeID("Usng");
var desc2 = new ActionDescriptor();
var idType = charIDToTypeID("Type");
var idcolorLookup = stringIDToTypeID("colorLookup");
desc2.putClass(idType, idcolorLookup);
var idAdjL = charIDToTypeID("AdjL");
desc1.putObject(idUsng, idAdjL, desc2);
executeAction(idMk, desc1, DialogModes.NO);// =======================================================
var lutPath = "D:/Project/LUT_test.cube";

var idsetd = charIDToTypeID("setd");
var desc3 = new ActionDescriptor();
var idnull = charIDToTypeID("null");
var ref2 = new ActionReference();
var idAdjL = charIDToTypeID("AdjL");
var idOrdn = charIDToTypeID("Ordn");
var idTrgt = charIDToTypeID("Trgt");
ref2.putEnumerated(idAdjL, idOrdn, idTrgt);
desc3.putReference(idnull, ref2);
var idT = charIDToTypeID("T ");
var desc4 = new ActionDescriptor();
var idlookupType = stringIDToTypeID("lookupType");
var idcolorLookupType = stringIDToTypeID("colorLookupType");
var idthreeDLUT = stringIDToTypeID("3DLUT");
desc4.putEnumerated(idlookupType, idcolorLookupType, idthreeDLUT);
var idNm = charIDToTypeID("Nm ");
desc4.putString(idNm, lutPath);
var idAdjL = charIDToTypeID("AdjL");
desc3.putObject(idT, idAdjL, desc4);
executeAction(idsetd, desc3, DialogModes.NO);
}


applyCubeLut();

Do you have the ScriptingListener plugin installed?


By @Stephen Marsh



Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 22, 2025 Sep 22, 2025

Forgetting adjustment layers, I successfully tested the direct application of one of the default LUTs from Adobe via the AM code recordered by the SL plugin. It's verbose as it captures the entire lookup table, but it works.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 22, 2025 Sep 22, 2025

I'm not sure how other filter plugin developers handle the "apply LUT" step. There might be a better way, as capturing the entire color lookup table is just too inflexible.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 23, 2025 Sep 23, 2025
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 27, 2025 Sep 27, 2025

Could you provide me with the code you attempted? I can't get it to auto-complete no matter what, even when I used the Scriptinglistener to read the entire binary data of the color table.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 27, 2025 Sep 27, 2025
LATEST

I have attached the code as a .txt file, as it contains over 6K lines. I have made the reference to the 3D LUT cross platform, the rest of the code is verbatim SL recorded. This example uses the default adobe "Candlelight" preset and is for direct application to a raster layer (not adjustment layer).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines