Copy link to clipboard
Copied
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!
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.
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).
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
Do you have the ScriptingListener plugin installed?
Copy link to clipboard
Copied
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
#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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Searching the forum, I found this:
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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).
Find more inspiration, events, and resources on the new Adobe Community
Explore Now