How to add a layer mask?

It may be simple, but it seems confusing, please I need help

Assuming that the variable myLayer is a layer object, the collection of all its masks is: myLayer.property ("ADBE Mask Parade");

and his children are the groups of actual masks (which can be renamed). To add a mask to the collection, you do:

var myMask = myLayer.property("ADBE Mask Parade").addProperty("ADBE Mask Atom");

You can define the name, color, attributes of Rotobezier etc. (optional):

myMask.name = "My mask";
myMask.color = [1,0,0];
myMask.rotoBezier = false;
myMask.maskMode = MaskMode.ADD;

To set its keyframable properties: property maskPath has special propertyType (SHAPE).

You must create a Shape() object like this before you set the value:

var myShape = new Shape();
// set the vertices (coordinates of the vertices in layer coordinates, not comp)
// + the inTangents (coordinates of the incoming Bezier handles with respect to the the corresponding vertices)
// + the outTangents (coordinates of the outcoming Bezier handles with respect to the the corresponding vertices)
// + the closed attributes
var w = myLayer.width, h = myLayer.height;
myShape.vertices = [[w/2, 0], [w,h], [0,h]];            // here: array of 3 "points"
myShape.inTangents = [[0, 0], [0, 0], [0, 0]];        // array of 3 "vectors"
myShape.outTangents = [[0, 0], [0, 0], [0, 0]];        // array of 3 "vectors"
myShape.closed = true;
// now set the value:
myMask.property("ADBE Mask Path").setValue(myShape);

In this example, all the tangents are 0 which gives a straight contour mask.

Unless you have your loan of shape data, insert more complex values of the tangents is not so much straighforward.

Xavier.

Tags: After Effects

Similar Questions

  • Listener code to add a layer mask does not work...

    With the help of Photoshop CC 2014 with all updates. The following script listener code has been saved when I clicked on the button, add a layer mask to add a mask to the active layer. When executeAction is called the script fails with the following error message. Help! How can I add a layer mask to the layer? Thank you.

    : Error General Photoshop. Maybe this feature is not available in this version of Photoshop. -The command 'Make' is not currently available.

    function addLayerMask() {}

    Adds a layer mask to the layer by clicking on the

    Add the button layer mask.

    var idMk = charIDToTypeID ("Mk");

    var desc23 = new ActionDescriptor();

    var idNw = charIDToTypeID ('Nw');

    var idChnl = charIDToTypeID ('channel');

    desc23.putClass (idNw, idChnl);

    var idAt = charIDToTypeID ('At');

    var ref20 = new ActionReference();

    var idChnl = charIDToTypeID ('channel');

    var idChnl = charIDToTypeID ('channel');

    var idMsk = charIDToTypeID ("Msk");

    ref20.putEnumerated (idChnl, idChnl, idMsk);

    desc23.putReference (idAt, ref20);

    var idUsng = charIDToTypeID ("Usng");

    var idUsrM = charIDToTypeID ("rocket");

    var idRvlS = charIDToTypeID ("LVR");

    desc23.putEnumerated (idUsng, idUsrM, idRvlS);

    executeAction (idMk, desc23, DialogModes.NO);

    }

    This code works if you have an active selection.

    function addLayerMask() {}

    Adds a layer mask to the layer by clicking on the

    Add the button layer mask.

    var idMk = charIDToTypeID ("Mk");

    var desc23 = new ActionDescriptor();

    var idNw = charIDToTypeID ('Nw');

    var idChnl = charIDToTypeID ('channel');

    desc23.putClass (idNw, idChnl);

    var idAt = charIDToTypeID ('At');

    var ref20 = new ActionReference();

    var idChnl = charIDToTypeID ('channel');

    var idChnl = charIDToTypeID ('channel');

    var idMsk = charIDToTypeID ("Msk");

    ref20.putEnumerated (idChnl, idChnl, idMsk);

    desc23.putReference (idAt, ref20);

    var idUsng = charIDToTypeID ("Usng");

    var idUsrM = charIDToTypeID ("rocket");

    var idRvlS = charIDToTypeID ("LVR");

    desc23.putEnumerated (idUsng, idUsrM, idRvlS);      reveal selection

    executeAction (idMk, desc23, DialogModes.NO);

    }

    app.activeDocument.selection.selectAll ();

    addLayerMask();

    To add a layer mask without an active selection is the scriptlistener code you would need

    function addLayerMask() {}

    var idMk = charIDToTypeID ("Mk");

    var desc25 = new ActionDescriptor();

    var idNw = charIDToTypeID ('Nw');

    var idChnl = charIDToTypeID ('channel');

    desc25.putClass (idNw, idChnl);

    var idAt = charIDToTypeID ('At');

    ref19 var = new ActionReference();

    var idChnl = charIDToTypeID ('channel');

    var idChnl = charIDToTypeID ('channel');

    var idMsk = charIDToTypeID ("Msk");

    ref19.putEnumerated (idChnl, idChnl, idMsk);

    desc25.putReference (idAt, ref19);

    var idUsng = charIDToTypeID ("Usng");

    var idUsrM = charIDToTypeID ("rocket");

    var idRvlA = charIDToTypeID ("RvlA");

    desc25.putEnumerated (idUsng, idUsrM, idRvlA);  reveal all

    executeAction (idMk, desc25, DialogModes.NO);

    }

    addLayerMask()

    There are once again hide all

    var idMk = charIDToTypeID ("Mk");

    var desc33 = new ActionDescriptor();

    var idNw = charIDToTypeID ('Nw');

    var idChnl = charIDToTypeID ('channel');

    desc33.putClass (idNw, idChnl);

    var idAt = charIDToTypeID ('At');

    var ref27 = new ActionReference();

    var idChnl = charIDToTypeID ('channel');

    var idChnl = charIDToTypeID ('channel');

    var idMsk = charIDToTypeID ("Msk");

    ref27.putEnumerated (idChnl, idChnl, idMsk);

    desc33.putReference (idAt, ref27);

    var idUsng = charIDToTypeID ("Usng");

    var idUsrM = charIDToTypeID ("rocket");

    var idHdAl = charIDToTypeID ("HdAl");

    desc33.putEnumerated (idUsng, idUsrM, idHdAl);     Hide all

    executeAction (idMk, desc33, DialogModes.NO);

  • Script to add the layer mask to all layers but the background?

    I have been a professional editor/Retoucher for photographers for the past three years. I use a lot of stock, but I've never branched in scripts so far. I am trying to refine my workflow and scripts to not appear to be the next logical step.

    I do a lot of work in the interiors, which is essentially manual HDR. Here's my current generation process, which I would love to find a way to script. I tried to be very clear, but let me know if it needs to expand. I use Photoshop CS5.

    1. pull brackets, color corrected TIFF in Bridge.

    2 re-order as needed, with the main exhibition downstairs. Click on 'Tools' > 'Photoshop' > 'Charge in the form of layers Photoshop"to get a PSD with layers in the correct order and main as exposure layer from bottom (base).

    3. manually go through each layer and add a layer mask hide all each layer except the background layer.

    4. Save as a PSD, using the original name of the background layer as the file name. To do this, I just copy the name of the layer (example.tiff), paste in the Save dialog box and then use the drop-down menu to select PSD (save as example.psd).

    I hope to automate steps 3 and 4 as they are the majority of your time for me. Any contribution is appreciated!

    Thanks again.

    Yes, your change is good.  This way the last layer will not have a mask applied.  I wasn't sure if you wanted that, but in the control for the background layer.

    Regarding the economy, what file format would you save on?  Here's how to save a psd:

    docRef var = activeDocument

    var doneFolder = new Folder('/c/photos/')

    var NomCouche = docRef.activeLayer.name

    var psdOptions = new PhotoshopSaveOptions();

    psdOptions.layers = true;

    app.displayDialogs = DialogModes.ALL;//include this line if you want that the coming dialog box.

    docRef.saveAs (new file (doneFolder + "/" + NomCouche + ".psd"), psdOptions);

    app.displayDialogs = DialogModes.NO;//Resets at ALL - you won't let it work on.

  • Add a layer mask shortcut?

    Hello, it is posible to add a shortcut to 'add a layer mask "?

    I can't find. Thank you

    Hi chochography,

    Select Edit > keyboard shortcuts and assign your own shortcuts for layer > layer mask > reveal all the

    Kind regards

    Assani

  • 'Add a layer mask "command.

    Hello

    Anyone know if there is a command 'add a layer mask "?  I've searched high and low and can't find it.  I could do an action assumes, but I thought I might ask the experts.

    Thank you.

    Just add a button in the menu photostops LAYER / LAYER MASK / REVEAL ALL or HIDE ALL if function

    you want a new white or black mask.

  • How to create the layer mask using ellipse (circle) to show the face of the watch only?

    just stuck - see how to get a job of layer mask using a brush, but can not get by with the help of an ellipse

    What I'm after is:

    * Start simple watch, with the face and band by photo

    * want to apply a layer, so the only thing I see the circular face of the watch (no tape etc.) and that the base is clear (alpha)

    May I ask what are the instructions step by step to achieve this goal by using layer masks & ellipse tool?  (i.e. not having to manually paint around the dial)

    Here's the original image:

    1. Make a copy of the background and work on this copy of background layer.
    2. Use the elliptical selection tool, hold down the SHIFT key to draw a circular selection:
    3. Select use (on the menu bar)... Transform the selection to move the selection, and drag the sides of the selection at the edges of the dial:
    4. After you click the green check mark, use the selection... Inverse to select all items except the dial of the watch and press your delete key to remove such things:
    5. Your layers look like this:

    Alternatively, if you want to use a mask, after step #3 hit the icon 'Mask' at the bottom of the Palette layers to create a mask layer automatically by using the selection:

    Ken

    Post edited by: photodrawken to add the alternative method of mask.

  • Add a layer mask

    Hello

    I came across this thread in the forum of items https://forums.adobe.com/thread/798304 and had the same question for the CC PS (I don't have the elements to see if this suggestion works there). I tried to add a selection to the layer mask to my pressing Shift/Ctrl and clicking on the thumbnail of the mask, but it does not work (the result has been to deselect the new selection and simply load the mask selection). Other/different way could there be to do?

    Thank you

    -David

    What operating system do you use?

    The same procedure, spoken in the post that you linked to should also work in photoshop cc

    But it probably really can't load the existing layer mask selection.

    After that you have the choice, you want to add to the layer mask, simply target the layer mask (click on the thumbnail of the layer mask to make it active), and then fill the selection with black or white.

  • How to add a vector mask?

    Hello:

    I would like to draw a circle with the Ellipse tool, and then add a vector mask

    I would like to duplicate the layer and then select the thumbnail of the mask vector in the layers panel so that when I select the pen tool intersect shape areas is available

    However, I can't seem to get the vector mask it is always grayed out to be available no matter what I try to do.

    I'm trying to add a "glossy" effect to the circle using the pen to draw a shape through it horizontally then upward and around the Summit of and join and closing it so that I can add a white > gradient trans.

    can someone help me please? I read the index of help etc until my face is blue and everything I read will not work.

    Thank you for your time.

    PS. using Ps cs6 and Windows 7

    Any given layer can have a pixel and a photomask vector. When you use one of the form tools, such as the Ellipse tool, you actually create a vector mask on a layer of filling. It was more apparent in earlier versions of Photoshop, but the user interface has been simplified so that the filling and the mask are now an icon in the layers panel. If you cannot add an additional vector mask to this layer, but you can add or subtract to the existing form of vector in the mask to change with the existing tools of vector.

    So, do exactly what you trying to do, but do not forget that the single icon see you in the layers panel after creation of the ellipse IS a vector mask, then you don't need to add anything more.

  • How to add the layer transparant

    How to add a transparent layer

    How to add text to this layer

    How do I save the text on the layer index

    Hello Stanleysreenname!

    Here are a few screen shots that explain how doing what you asked!

    Click anywhere on the canvas to start typing your text!

    To customize your text, you can use the tools in the character Panel. (Window > character)

    To merge the text layer with SHIFT + click on the layer background, the two layers and then right-click and select link layers:

    I hope this helps!

    Julia

  • How to make a layer mask to type in CC?

    I am after this Tutorial: Photoshop: professional cleaning Logo - YouTube and can not find a way to make the mask layer type thing that makes the background show through. I know that the tutorial is for CS6, but they should be the same, right?

    The layer mask is the same for CS6 & CC. There are several ways to do so. But the video showed him using the masking of the text tool. It uses the quick mask to make the text - where the color pink. You can size your text by holding down the ctrl/cmd key to appear of the transformation handles. Once you are happy with the size of the text, click on the checkbox validate or ctrl/cmd + enter to change quick mask in a selection. The video then shows the selection used to create a mask on a layer. To invert the mask, and punch through the layer text to show the blue below, the opt/alt key has been pressed while the mask icon has been selected in the layers panel.

  • How to make invisible layer masks

    I have a text im use as headers on a background is textured. but after the application of effects scroll, I can't find a way to get the text to disappear under the header. pls see attached image. I want the text disappear under the title of HONOR. There is a before and after the photo attached. any help welcome. Thank you in advance.

    before.jpg

    after.png

    Duplicate the texture of paper and create a transparent visor mask in Photoshop. (just low enough to block what you want but the same width as the original)

    Create a layer between the paper and the text. Pin the new transparent .png image upward to match the document below

    Make sure that the text of HONOR is the top layer of most.

  • Layer masks

    Hi all

    This is the first time I visited these forums so apologies if this repeated question.

    Basically, I'm wanting to know how to add a layer mask to a layer with the option show using vbscript. I should point out that I am a complete newbie when it comes to programming/scripting etc but uses photoshop for some time.

    I've been reading through the guide pdf script and I found how to do things like, to create new documents, open documents, resize, copy, and paste between documents and move layers in a document, but it seems to have hit a brick wall, when you want to add a layer mask to a layer. I am wanting to do this because I want to use the gradient tool, then fade the image in another.

    The research I've done, it seems that the only way to do that is through the listener from script? If this is the case I will need a good reading about it because I don't have my head around this yet and just wanted to know if there was an easier way to do this first?

    Thanks in advance for any help.

    Also you must really understand all of the code in scriptlistner to use it. The following code will add a reveal all the mask layer to the activeLayer.

    DIM objApp
    SET objApp = CreateObject("Photoshop.Application")
    REM Use dialog mode 3 for show no dialogs
    DIM dialogMode
    dialogMode = 3
    DIM idMk
    idMk = objApp.CharIDToTypeID( "Mk  " )
        DIM desc3
        SET desc3 = CreateObject( "Photoshop.ActionDescriptor" )
        DIM idNw
        idNw = objApp.CharIDToTypeID( "Nw  " )
        DIM idChnl
        idChnl = objApp.CharIDToTypeID( "Chnl" )
        Call desc3.PutClass( idNw, idChnl )
        DIM idAt
        idAt = objApp.CharIDToTypeID( "At  " )
            DIM ref2
            SET ref2 = CreateObject( "Photoshop.ActionReference" )
            DIM idChnl
            idChnl = objApp.CharIDToTypeID( "Chnl" )
            DIM idChnl
            idChnl = objApp.CharIDToTypeID( "Chnl" )
            DIM idMsk
            idMsk = objApp.CharIDToTypeID( "Msk " )
            Call ref2.PutEnumerated( idChnl, idChnl, idMsk )
        Call desc3.PutReference( idAt, ref2 )
        DIM idUsng
        idUsng = objApp.CharIDToTypeID( "Usng" )
        DIM idUsrM
        idUsrM = objApp.CharIDToTypeID( "UsrM" )
        DIM idRvlA
        idRvlA = objApp.CharIDToTypeID( "RvlA" )
        Call desc3.PutEnumerated( idUsng, idUsrM, idRvlA )
    Call objApp.ExecuteAction( idMk, desc3, dialogMode )
    
  • How to copy a channel alpha to an adjustment layer mask?

    I can copy a mask in alpha channel to a layer of the image by Ctrl + click on the alpha channel, then by clicking on the icon Add a layer mask in Photoshop CC, but it does not work for an adjustment layer. How can I copy the mask to alpha channel to the layer of an adjustment layer mask? Thank you.

    Drag the Alpha channel down to the channel to load as a selection symbol.

    Return the Panel layers, click the adjustment layer and choose an adjustment layer.

    The Alp\ha channel is displayed in his mask.

  • Copy a texture in a layer mask... How?

    This issue has been plaguing me for years and I thought I'd come and finally to remove once and for all that itch.

    See this picture? http://fc05.deviantart.NET/FS42/f/2009/072/7/0/Grunge_Texture_by_skeelar_stock.jpg

    Say I want to use it as on a specific layer opacity mask, or a specific group of layers. How can I do?

    I mean, I know I can select with the wand and then add a layer mask in the form of what I chose, but transparency/alpha information will be deleted. Parts of the mask will be transparent or opaque.

    Copy of a layer with gradients - as one of a worn paper texture - in a layer mask is something that I was not able to do. But I'm sure it's possible, because masks can do different levels of alpha very well (they would be quite useless if they do not have).

    Select all, copy (or copy merged if you have several layers) in the file that you want to make a mask. Go to the image that you want to add to the mask. Select the layer you want to hide. Create a layer mask. Make sure that this mask is active in alt-clicking above. Dough.

  • How to view the alpha channel of the layer mask in the layers palette?

    Help out me people CIHI...
    CS5 using - in the past, when I added a layer to a layer mask, it would appear in the palette as the alpha channel, which was very convenient. Now, when I add a layer mask, it appears only as the icon of mask; that is, square gray with a white circle in the middle. I have no idea what I did to go from one to the other, but I'd like to return the alpha representation!

    TIA,

    Toby

    Looks like you have set the layers panel to "no thumbnails. Right-click on a layer thumbnail (not a mask thumbnail) other than the bottom to see the thumbnails options.

Maybe you are looking for

  • then a MBP 15 "2011 run the last OSX

    Looking at an old mac for my use and modular memory, I wonder what the last OSX support available for 2011 models?

  • How to use firefox 18 metro mode?

    I tried to find solutions on google but none of them worked. I have firefox set as my default browser, but nothing helped. Please provide a working solution.

  • Tecra P11 cannot communicate with scanner

    6 months ago, I replaced my old Tecra A3 with a P11. For almost all of this time, it was a lottery if the P11 would communicate with the scanner function (fine print) of my Canon MP170 printer/scanner. The only reliable method that I had was back sys

  • Firefox 8 displays the source at insead nested HTML IFRAME

    I got IFRAME nested for a few years, Firefox and other browsers display them without problems, but today with Firefox 8, I see the HTML source of the embedded iframe. My test scenario had a graph of Google in it, but because it is only the display of

  • Installation directory for install

    For legacy reasons, all our applications must be installed on the D: drive in a directory called programs. I don't see how to create a distribution that will do that. What Miss me?