Copy link to clipboard
Copied
Hi community,
I try to create a layerset mask from artlayer. Basically I want to copy an artlayer to a layer group mask.
(I am 3D rendering images and alpha channels, import them as layers and want to use the alpha layer as mask of a layer group)
My script is working fine so far, I even managed to create a layerset mask and to copy the artlayer (alpha chanel) to the clipboard by script. But I am not able to paste this into the layerset mask.
Any hint or idea how to suceeed? Thanks, Niclas
I prefer to use the apply image command for this task:
Presuming ExtendScript over UXP, target the destination layer group mask, then:
applyImageEvent("Alpha"); // string for the source layer name
function applyImageEvent(layerName) {
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var descriptor2 = new ActionDescriptor();
var reference = new ActionReference();
reference.putEnumerated( s2t( "channel" ), s2t( "channel" ), s2t( "
...
Copy link to clipboard
Copied
I prefer to use the apply image command for this task:
Presuming ExtendScript over UXP, target the destination layer group mask, then:
applyImageEvent("Alpha"); // string for the source layer name
function applyImageEvent(layerName) {
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var descriptor2 = new ActionDescriptor();
var reference = new ActionReference();
reference.putEnumerated( s2t( "channel" ), s2t( "channel" ), s2t( "RGB" ));
reference.putName( s2t( "layer" ), layerName ); // source layer name
descriptor2.putReference( s2t( "to" ), reference );
descriptor2.putBoolean(s2t("preserveTransparency"), true );
descriptor.putObject( s2t( "with" ), s2t( "calculation" ), descriptor2 );
executeAction( s2t( "applyImageEvent" ), descriptor, DialogModes.NO );
}
If there are multiple layer names called "Alpha" then this will use the first layer name found, which may or may not be problematic.
P.S. If you do need to use copy/paste, ensure that you are targeting the correct destination and you may also need to enable and disable channel visibility.
Otherwise, you can load the composite/component RGB channel as a selection and create a new layer mask on the group using that selection.
Copy link to clipboard
Copied
RGB-ing a grayscale image and then grayscaling it again is not an ideal approach.
Why don’t you use it as a Layer Mask right away?
Copy link to clipboard
Copied
I dont know exactly what you mean, but it works for me. Perhaps to clarify:
After importing .exr files in Photoshop (via 3D-io photoshop plugin https://www.exr-io.com/reading-openexr-files/), the alpha information is not stored in image alpha channel, but as a layer. And I need the alpha to be in a layerset mask.
Copy link to clipboard
Copied
Hi Stephen, works like a charm! I tested it with various layer sources - thanks to the source layer name parameter! Perfect!
I can even use this for further experiments... For example with adjustement layer masks. If I use the shadow pass from my 3d rendering software, copy it into an adjustement layer Hue/Saturation, I will be able to colorize the shadows light blue or to lighten the shadows.
Thank you very much!