hi, is there any way to import 3d lut file? i also tried with alchemist but the generated code doesn’t work.
Can you share the generated code you tried to use?
const batchPlay = require(“photoshop”).action.batchPlay;
const result = await batchPlay(
[
{
“_obj”: “make”,
“_target”: [
{
“_ref”: “adjustmentLayer”
}
],
“using”: {
“_obj”: “adjustmentLayer”,
“type”: {
“_class”: “colorLookup”
}
},
“_isCommand”: true,
“_options”: {
“dialogOptions”: “dontDisplay”
}
},
{
“_obj”: “set”,
“_target”: [
{
“_ref”: “adjustmentLayer”,
“_enum”: “ordinal”,
“_value”: “targetEnum”
}
],
“to”: {
“_obj”: “colorLookup”,
“lookupType”: {
“_enum”: “colorLookupType”,
“_value”: “3DLUT”
},
“name”: “H:\red.cube”,
“profile”: {},
“LUTFormat”: {
“_enum”: “LUTFormatType”,
“_value”: “LUTFormatCUBE”
},
“LUT3DFileData”: {},
“LUT3DFileName”: “H:\red.cube”
},
“_isCommand”: true,
“_options”: {
“dialogOptions”: “dontDisplay”
}
}
],{
“synchronousExecution”: false,
“modalBehavior”: “fail”
});
thanks
In cep you could import this code, to apply a lut, is there an equivalent?
function fixskin(){
var idsetd = charIDToTypeID( "setd" );
var desc736 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref363 = new ActionReference();
var idAdjL = charIDToTypeID( "AdjL" );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref363.putEnumerated( idAdjL, idOrdn, idTrgt );
desc736.putReference( idnull, ref363 );
var idT = charIDToTypeID( "T " );
var desc737 = new ActionDescriptor();
var idlookupType = stringIDToTypeID( "lookupType" );
var idcolorLookupType = stringIDToTypeID( "colorLookupType" );
var idthreeDLUT = stringIDToTypeID( "3DLUT" );
desc737.putEnumerated( idlookupType, idcolorLookupType, idthreeDLUT );
var idNm = charIDToTypeID( "Nm " );
desc737.putString( idNm, "skin.3dl" );
var idprofile = stringIDToTypeID( "profile" );
desc737.putData( idprofile, String.fromCharCode( 0, 1, 111, 156, 65, 68, 66, 69, 2, 16, 0, 0, 108, 105, 110, 107, 82, 71, 66, 32, 82, 71, 66, 32, 7, 228, 0, 9, 0, 12, 0, 15,
0, 41, 0, 36, 97, 99, 115, 112, 65, 80, 80, 76, 0, 0, 0, 0, 110, 111, 110, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 0, 0, 246, 214, 0, 1, 0, 0, 0, 0, 211, 45, 65, 68, 66, 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 3, 100, 101, 115, 99, 0, 0, 0, 168, 0, 0, 0, 97, 112, 115, 101, 113, 0, 0, 1, 12, 0, 0, 0, 12, 65, 50, 66, 48…ecc…ecc…ecc
) );
var idLUTFormat = stringIDToTypeID( “LUTFormat” );
var idLUTFormatType = stringIDToTypeID( “LUTFormatType” );
var idLUTFormatthreeDL = stringIDToTypeID( “LUTFormat3DL” );
desc737.putEnumerated( idLUTFormat, idLUTFormatType, idLUTFormatthreeDL );
var idLUTthreeDFileName = stringIDToTypeID( “LUT3DFileName” );
desc737.putString( idLUTthreeDFileName, “skin.3dl” );
var idcolorLookup = stringIDToTypeID( “colorLookup” );
desc736.putObject( idT, idcolorLookup, desc737 );
executeAction( idsetd, desc736, DialogModes.NO );
}
I still do not see documentation on how to work with raw data type in batchPlay therefore I couldn’t make it work in Alchemist since it records arrayBuffer but I had no luck playing arrayBuffer back.
Anyway, in options, you can turn it on to convert arrayBuffer into array so you can read the numbers from raw data type but generated code still won’t work.
Adobe: please document raw data type and how to play it back.
I have a great esteem for you.you were great.
I hope that the situation will be rectified soon from adobe.
but I’m sure of it
Thanks
What about making an advanced profile from the lut and applying it with cr filter?
there are a lot of things you can do through the luts, for example specific masks based on hue and saturation.
I have the raw data from LUT files and would like to apply that.
Has anyone figured out how to pass the raw data.
New Alchemist version 1.3.0 with the grouping of items with the same content and Raw data type support is available now (don’t forget to enable it in code options)
First I have to say thanks to Jarda.
Do are doing a great job with your alchemist-tool.
I have tried to record importing a 3dlut file. So faar so good. But If i try to play it, it is not working.
Error diplayed in alchemist:
“Replay failed
unknown exception caught”
What do I do wrong? Group and raw Data are enabled.
Thanks
I have no idea. I would need to have more information.
Dear Jarda,
here the complete code alchemist shows.
look-import.rtf.zip (170.1 KB)
Would be great if you have an Idea to get it run…
For me it would be ok to place the 3dlut-File in the plugin-folder and then to adopt it on the layer.
May be this could be easier to realise.
Thanks a lot.
When I tried PS built-in LUT then I was able to record and Dispatch and it also looked very similar. But for replay… I do internally store raw as ArrayBuffer and maybe I forgot conversion into base64 when you click the replay button. I have to check.
Did you try to execute code outside of Alchemist?
Hmm, there should be at least an action name in that error. But there is none.
Has no one an idea how to add a color lookup layer and to import a 3d lut file?
The file could be stored in the pluginfolder as a .3dl file.
Hi ALL,
Since there is no answer, here is my ugly way to do it: generate an action to make the lookup layer and call it with playAction.
However, I would like to know the UXP way to do this.
I know this is old, but this is what I came up with to resolve this, but I want to make this easy on the end user please read below:
{ _obj: "make", _target: [ { _ref: "adjustmentLayer" } ], using: { _obj: "adjustmentLayer", type: { _class: "colorLookup", presetFileName: "Exterior.cube" // (DOES NOT WORK) } }, _options: { dialogOptions: "dontDisplay" } }, { _obj: "play", _target: [ { _ref: "action", _name: "Exterior Lut" }, { _ref: "actionSet", _name: "Luts" }
},
actionSet is the name of the folder in my actions, action is the name of the action to execute.
Sorry for reviving this old thread, I was searching while I had the issue and saw this not seemingly answered, and I’m curious if there is a way to have the script look into the plugin folder for a preset… something like “\lut\preset.cube” this way it can be bundled easily with my plugin.
Thank you.
The only way I got LUTs to work is when they have been converted to *.icc format.
Here is some example code where the LUT file is placed in the plugin folder:
const batchPlay = require('photoshop').action.batchPlay;
const executeAsModal = require('photoshop').core.executeAsModal;
const fs=require('uxp').storage.localFileSystem;
const formats = require('uxp').storage.formats;
async function createColorLookup(){
const lutFile = await fs.getEntryWithUrl("plugin:/resources/MyLUT.icc");
const lutData = await lutFile.read({format:formats.binary});
await executeAsModal(async (executionContext) =>{
await batchPlay([
{
_obj: "make",
_target: [
{
_ref: "adjustmentLayer"
}
],
using: {
_obj: "adjustmentLayer",
type: {
_class: "colorLookup"
},
name : "MyLUT"
}
},
{
_obj: "set",
_target: [
{
_ref: "adjustmentLayer",
_enum: "ordinal",
_value: "targetEnum"
}
],
to: {
_obj: "colorLookup",
lookupType: {
_enum: "colorLookupType",
_value: "deviceLinkProfile"
},
name: lutFile.name,
profile: {
_rawData: "binary",
_data: lutData
}
}
}
],{})
});
}
For other color lookup formats, e.g. *.cube, I had no luck yet.