Perform conditional actions based on layer mask values / content
Hello community, hope eveybody is doing great!
I would need your help on expanding a script set that relies on mask properties.
My current workflow consists of stacking some layers into a single file and then auto creating masks,
based on their content attributes.
Since the task is based on a same repeated object set, the results of the masks produced,
can be classified into 5 "categories" depending on the size of the object detected or not.
For the sake of simplicity I name them after :
1) White Mask
2) Black Mask
3) Large Mask
4) Medium Mask
5) Small Mask
For each result I have assigned a script that performs certain actions.
1 & 5 ) Perfom no action in mask is White or Black
2) Perform ("Subtrack 25px", "Large Masks")
3) Perform ("Subtrack 5px", "Medium Masks")
4) Perform ("Expand 25px", "Small Masks")
The latter processes are performed manually via a quick visual selection and the used
of a modded PS-Scripts-master subset like "Run [X] Action on selected layers"
I was wondering if there is any method to iterate / "measure" each mask content,
and based on a specific value ( like Mean Histogram Value with of Selected Layer while mask is visible )
conditionally perform the above actions based on a certain range.
Example Mean Range Values :
1) O < No action < 200
2) 200 < Subtract 25px < 220
3) 221 < Subtract 5px < 235
4) 236 < Expand 25px < 249
5) 249 < Expand 25px < 255
To the moment I havent found a way to access these values in direct.
The only thing I have come up with - but havent tried yet - is to temporarily,
make each single layer visible, create a temporary pixel layer on top of from the mask,
measure it, play the action on the "parent" below and delete the temp layer.
Any help would be much appreciated !
