Layer Opacity Alchamist

Using Alchamist to get the value of the current Layer Opacity.

Photoshop reports 50% and Alchamist reports 128.
Now I am guessing that Alchamist is showing 0 -255 as 128 is 50%

How can I get Alchamist to show what PS reports or convert the Alchamist number to match PS

One helper function:

const calcPercent = (val, total) => {
   return (val / total) * 100
}

I don’t know if Alchemist can return values as %

Thanks for the helper function.
Im not sure why Alchamist reports 128 when the opacity slider is set to 50%.

If I set the Feather Mask slider to 50% Alchamist returns 50 which is what I would have expected

I have no idea, but I’d stab a guess that it’s just the nuances of the PS interface. Like, opacity is an rgba value and thus a range of 0-255, whereas feather is not and has an underlying value range of 0-100%.
Alchemist just spits out what Photoshop’s doing, I assume it makes no value judgements about how that data is rendered in the UI or interpreted by the end user.
It’s just one of those things innit? :rofl:

1 Like

Alchemist shows you raw data (if possible) that are available via batchPlay. Meanwhile DOM tries to make scripting more human friendly and match your expectations.

Thanks @Jarda that explains it. I will use the helper function above to convert the RAW data into a %

I think you could also use DOM. https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/layer/

Perfect, thanks @Jarda