PS Legacy Array

Below is an example of getting the gamma values using the legacyArray.
Is this legacyArray okay to be using, or will it be deprecated? What are other options that might be better to use instead of the legacyArray?

const adjustment = require('photoshop').action.batchPlay([layerGetter], { synchronousExecution: true })
var legacyArray = adjustment[0].adjustment[0].legacyContentData;
const typedArray = new Int8Array(legacyArray);
var currGamma = fourBitsToFloat(typedArray[10], typedArray[11], typedArray[12], typedArray[13]);

I would say legacyContentData is ok to read if are willing to interpret it on your own.

There are definitely plans to modernize this but I am not sure if this legacy will be available. But right now you don’t have much other options.

There appears to be a problem using @jyoon’s code in the new Photoshop Beta version 24.6.0.

Based on the above code, I created the following:

const adjustment = batchPlay([{ "_obj": "get", "_target":{ "_ref": "layer", "_enum": "ordinal", "_value": "targetEnum" } }], { synchronousExecution: true })
var legacyArray = adjustment[0].adjustment[0].legacyContentData;
const typedArray = new Int8Array(legacyArray);
console.log(typedArray)

In the current product version of Photoshop (version 24.4.1) it produces the following output in the console for an un-adjustment Levels adjustment layer.

Int8Array(632) [0, 2, 0, 0, 0, -1, 0, 0, 0, -1, 0, 100, 0, 0, 0, -1, 0, 0, 0, -1, 0, 100, 0, 0, 0, -1, 0, 0, 0, -1, 0, 100, 0, 0, 0, -1, 0, 0, 0, -1, 0, 100, 0, 0, 0, -1, 0, 0, 0, -1, 0, 100, 0, 0, 0, -1, 0, 0, 0, -1, 0, 100, 0, 0, 0, -1, 0, 0, 0, -1, 0, 100, 0, 0, 0, -1, 0, 0, 0, -1, 0, 100, 0, 0, 0, -1, 0, 0, 0, -1, 0, 100, 0, 0, 0, -1, 0, 0, 0, -1, …]

This array is a list of all the different settings within the Levels adjustment layer.

However, in Photoshop Beta version 24.6.0, the output to the console is:

Int8Array [buffer: ArrayBuffer(0), byteLength: 0, byteOffset: 0, length: 0]

The problem appears to be that

var legacyArray = adjustment[0].adjustment[0].legacyContentData;

returns undefined in the console. In other words, legacyContentData is no longer available, it seems, in the newest version of Ps Beta.

Is this a bug, or is there going to be a new way to access “legacyContentData” going forward?

Right now I can’t find a way to access “legacyContentData” in Photoshop Beta version 24.6.0.

1 Like

Never mind. Looks like Adobe is moving legacyContentData to a new adjustment object. Alchemist finds it.

2 Likes