Getting adjustment values from adjustment layers

Is it possible to get the adjustment value of, for example, a brightness adjustment layer as an json object?
I tried with Alchemist and some loops / maps in the console but wasn’t lucky.

Yes it’s possible. Why would you need a JSON object for that ?

1 Like

Does not neccessarily need to be a json object. It could be anything. I just need to sync the adjustment values of the layers to the adjustments in my plugin when for example a document is opened or selected.

Ok, then try to call this function on a Brightness/Contrast layer.

function getBrightness() {
    const result = batchPlay(
        [{
            "_obj": "get",
            "_target": [{
                    "_property": "json"
                },
                {
                    "_ref": "layer",
                    "_enum": "ordinal",
                    "_value": "targetEnum"
                },
                {
                    "_ref": "document",
                    "_enum": "ordinal",
                    "_value": "targetEnum"
                }
            ],
            "_options": {
                "dialogOptions": "dontDisplay"
            }
        }], {
            "synchronousExecution": true,
            "modalBehavior": "fail"
        });
    const getBrightness = JSON.parse(result[0].json).layers[0].adjustment.brightness;
    console.log(getBrightness)
}
1 Like

You made my day Pierre! Works like a charm, thank you so much for helping me out!

You’re most welcome!

1 Like

Note: individual channels in curves are not readable. Unless something changed since last time.

1 Like