Does anyone know the way to change the histogram from “Entire Image” to “Source Layer” in javascript?
Alchemist can give me the Histograms values as a 256 value Array, with the total pixel count as the last value, however I can’t figure out how to access the other settings the Histogram has
Alchemist gives the below
[
{
"histogram": [0,
//255 more 0's
50 //total number of pixels
]
}
]
Basically i’m trying to create a function that can check a selection to see if there are any pixels in it, so maybe there is another way
You can create a pixel selection within which you will read the histogram. I think this should work. But if your layers are not perfect rectangles then it gets more complicated.
That’s what the function above does actually. Or maybe I didn’t get your question. Function returns false if no pixels in the selection. Else, you get the selection coordinates of it. Makes sense?
For me it detects if a selection is active, and if it is, give the 4 boundary points as an array, if no selection is active then it returns false - is that correct?
That’s a useful function, but what I’m after specifically is some sort of function that can detect if there are any rasterized pixels inside the selection.
The histogram has the ability to show if there are any pixels within the selection on the active layer when it’s switched to “Selected Layer”. If it’s set to document it works on all layers merged.
Basically I have a function that makes a selection in a constant area of a document, then does a warp/transform on the selected layer. I’m trying to get a method of stopping the function running in case the user hasn’t moved the image/layer within the selection bounds which would result in the “Could not transform the selected pixels because the selected area is empty.” warning