Copy link to clipboard
Copied
is there a check that i can do that will return whether or not the active layer has transparent pixels? thanks a trillion!
Copy link to clipboard
Copied
Alright everyone calm down, i know everyone was in the middle of writing an answer but i found something that while is not precisely what i intended, gets the job done for what i needed.
the =
isBackgroundLayer
property of an artlayer. which pretty much tells me whether or not the ducoument is flattened. I know that i can check whether or not individual pixels have transparency but that would make the entire script a lot more complicated than what i actually need.
By the way, EVERYONE Gets to keep their million thanks!!!
Copy link to clipboard
Copied
Just want to point out that a background layer is format specific. I.e. if you create a doc with transparent background, it does not have a background. And flattening a doc without background does not create one. Also in case you need to check per-layer, see function below
isAreaEmpty: function (left, top, right, bottom) {
var selection_area = new Array(new Array(left, top), new Array(right, top), new Array(right, bottom), new Array(left, bottom))
var selection = app.activeDocument.selection
selection.select(selection_area)
try {
selection.copy()
} catch (e) {
return true
} finally {
selection.deselect()
}
return false
},
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Another option might be to select the transparency, then check the Selection’s histogram.