Copy link to clipboard
Copied
hi,
i'm very confused and challenged in understanding on how a photoshop script can
access step-by-step each indidual pixel of a given layer in order to check it's
transparency. means, I need to identify transparent pixels.
I especially need to check whether/which pixels are transparent. isn't this transparency coded
in the alpha value of a pixel? I have transparent pixels in my PSD file layer, but there is no
alpha channel displayed in photoshop, only the three R, G and B layers. how can this work?
thanks for any help.
best
stephen
Testing each pixel would take forever.
You can do this though...
...#target photoshop
main();
function main(){
selectTransparency();
try{
var sBnds = app.activeDocument.selection.bounds;
}catch(e){
alert("This layer does not have transparency");
return;
}
alert("Transparent pixels have been selected");
}function selectTransparency() {
var desc52 = new ActionDescriptor();
var ref47 = new ActionReference();
ref47.putProperty( charIDToTypeID('Chnl'), charIDToTypeID('fs
Copy link to clipboard
Copied
Testing each pixel would take forever.
You can do this though...
#target photoshop
main();
function main(){
selectTransparency();
try{
var sBnds = app.activeDocument.selection.bounds;
}catch(e){
alert("This layer does not have transparency");
return;
}
alert("Transparent pixels have been selected");
}function selectTransparency() {
var desc52 = new ActionDescriptor();
var ref47 = new ActionReference();
ref47.putProperty( charIDToTypeID('Chnl'), charIDToTypeID('fsel') );
desc52.putReference( charIDToTypeID('null'), ref47 );
var ref48 = new ActionReference();
ref48.putEnumerated( charIDToTypeID('Chnl'), charIDToTypeID('Chnl'), charIDToTypeID('Trsp') );
desc52.putReference( charIDToTypeID('T '), ref48 );
desc52.putBoolean( charIDToTypeID('Invr'), true );
try{
executeAction( charIDToTypeID('setd'), desc52, DialogModes.NO );
}catch(e){}
};
This would be the same as :-
Selection - Load selection - Layer # Transparency with Invert selected.