How to add layer mask?

Must add each layer of the document (except the background) mask blank:
There is such a script:
if(app.documents.length>0){
    var docRef = activeDocument;
    var layerNum = docRef.layers.length;
    for(var i=0;i<layerNum;i++){
        docRef.activeLayer = docRef.layers[i];
        if(!docRef.activeLayer.isBackgroundLayer){
            try{addMask ()}
            catch(e){}
else{alert('There are no open files')};
function addMask(){
    var idMk = charIDToTypeID( "Mk  " );
        var desc2 = new ActionDescriptor();
        var idNw = charIDToTypeID( "Nw  " );
        var idChnl = charIDToTypeID( "Chnl" );
        desc2.putClass( idNw, idChnl );
        var idAt = charIDToTypeID( "At  " );
            var ref1 = new ActionReference();
            var idChnl = charIDToTypeID( "Chnl" );
            var idChnl = charIDToTypeID( "Chnl" );
            var idMsk = charIDToTypeID( "Msk " );
            ref1.putEnumerated( idChnl, idChnl, idMsk );
        desc2.putReference( idAt, ref1 );
        var idUsng = charIDToTypeID( "Usng" );
        var idUsrM = charIDToTypeID( "UsrM" );
        var idHdAl = charIDToTypeID( "HdAl" );
        desc2.putEnumerated( idUsng, idUsrM, idHdAl );
    executeAction( idMk, desc2, DialogModes.NO );
It runs and adds a mask, but it is filled with black:
How to change the code to create an empty mask (like in the first picture)?
Sorry for my english...

Line 30 you have the actionmanager "HdAl" hide all… Record again using show all…?

Similar Messages

  • How to get "Layer Mask Hides Effects" from Photoshop Plug-in

    How to get "Layer Mask Hides Effects" from Photoshop Plug-in.

    I don't think there's enough information here to give an answer.  Is this a Plug-in that you're writing or intend to write?  If so, what type of Plug-in is it?
    If you are writing your own plug-in, the header files included in the Photoshop SDK/API have a bunch of defines for the proper codes to use.
    PITerminology.h has a large amount of keys that can be used to query for information.  PIUGetInfo is probably the function that you want to call to determine what you need to know.
    If you're looking for information about a specific layer, you will want to make a new PIActionDescriptor, call sPSActionDescriptor->Make(*PIActionDescriptor), and then call GetLayerInfo on the layer that you're querying information about.
    You can then call sPSActionDescriptor->Get<datatype> on the layer while passing in the key of the data that you want.

  • How do add a mask to a layer?

    It may be basic 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 its children are the actual masks groups (which can be renamed). To add a mask to the collection you do:
    var myMask = myLayer.property("ADBE Mask Parade").addProperty("ADBE Mask Atom");
    Then you can set its name, color, rotoBezier attributes etc (optionnal):
    myMask.name = "My mask";
    myMask.color = [1,0,0];
    myMask.rotoBezier = false;
    myMask.maskMode = MaskMode.ADD;
    To set its keyframable properties: the maskPath property has special propertyType (SHAPE).
    You need to create a Shape() object like this before setting 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 tangents are 0 which gives a mask with straight contour.
    Unless you already have your shape data ready, inserting more complexe values for tangents is not so straighforward.
    Xavier.

  • How to use layer masks to separate line art from white background

    How to use layermasks to separate line art from white background

    Probably better to use Blend modes rather than a layer mask.  Try setting the blend mode of the line art layer to Darken for instance.  If you do want to use a mask, take a look at individual channels, and copy the channel with the best contrast.   Then load the selection  of that copied channel, select the line art layer, and add the layer mask.  You will probably need to invert the mask. You will probably find that the line art is a greyscale image, and need to go to Image > Mode > RGB before you can use Channels.

  • How to add layer adjustments to workspace?

    If I choose the Photography workspace, I get four mini icons: MiniBridge, Actions, History, and Clone Source. How do customize these icons?  I would like to have Levels, Curves, Add a mask, Saturation, etc, as mini icons. Currently I have the full Adjustments Panel on top of Layers, Channels, and Paths. I'm talking about adding the small icons that appear to the left of this, those icons that change as you choose Essentials, Design, Painting, Photography, etc. Thanks!!

    Hi
    If you've got any panel or panel (tab) group and you want to turn them into small icons (they're actually referred to as 'floating docklets') then all you need to do is click on the small double-arrow at the top right of the panel/group - see the image below..
    If you're talking about splitting the adjustments panel that can't be done as far as I'm aware, although you could create individual panels (for destructive adjustments from the image > adjustments menu) using the Adobe Configurator application: http://labs.adobe.com/technologies/configurator/ (as mentioned above).
    Hope that helps
    Tony

  • Swap black and White in layer mask

    How do I change the default settings for the layer mask, as I'd like to swap black and white color.

    hi steenmikkelsen2,
    white means that your mask is transparent until you fill it with black. since then, there was no option to change the mask default settings from white to black otherwise you have to do what Noel suggested. but i hope my suggestion will help you better.
    ►press "Alt" key on your keyboard simultaneously as you click on the "Add Layer Mask" button under the Layers panel. that switches a white layer mask to black. :-)

  • Layer mask option delete not working

    hi, new to forum.  Looked up everything before posting now lost! 
    usually I can create an adjustment layer make changes, then option+delete and erase where I want the changes to take effect.  but now I can not, option delete doesn't work and brings back the following error:
    "Invalid numeric entry. An integer between -180 and 180 is required.  Previous value inserted." I've tried resetting everything, uninstalling, etc. nothing seems to work.  anyone know how to fix this?
    thanks
    belinda

    I used to be able to add a layer mask by option delete
    I think you are mistaken, option-delete fills with the foreground color, it does not add Layer Masks.
    Is "Add Mask by Default" checked in the Adjustments Panel’s fly-out menu?

  • Fading A Drop Shadow - Missing 'Layer Mask Hides Effects' in CS5

    I'm using CS5.  I want to create a fading drop shadow on a shape/box. See the attached image below.
    In Photoshop, this is easy by doing:
    1) Create shape
    2) Add layer mask to shape layer
    3) Click gradient, set gradient to Multiply, and set gradient colors to white to black
    4) Drag gradient where you want it on the shape.  The drop shadow will actually bleed through the middle of the shape, and not just on the edges, which is unwanted.
    5) Open up layer styles, under Blending Options, select Layer Mask Hides Effects and it will get rid of the drop shadow showing up in the middle of the shape and you will be left with perfect, faded drop shadow on the edges (see below for finished product).
    Firework is missing step 5.  There is no Blending Options and there is no Layer Mask Hides Effects.   Or if there is, I have no found them. I am using CS5.  Any ideas how to accomplish this in Fireworks?

    Clone the shape. Change the color of the clone to gray and, in the properties panel, change its edge type to feather.  With the clone still selected, choose Commands > Creative > Auto Vector Mask. Select the bottom, left mask type by clicking on its image, and then apply it. In the layers panel, click on the new mask group to select it. Click on the black masking object on the right of the two linked objects to activate the gradient adjustment handle. Shorten and rotate the gradient until you get the effect you want.

  • Lock Layer Mask position?

    Hey all.
    Just wondering if anyone knows how to lock a layer mask's position but still be able to move the actual layer around in case you want to re-position it?
    Here's what I've got.
    Layer 2 = Frame (Black triangular border)
    Layer 1 = Photo
    I want to be able to create a mask that removes anything that falls outside the frame without actually destroying the photo below it. I want to be able to re-position the photo as needed until I get it perfect without moving the mask.
    When I click the "Add Layer Mask" button it adds the mask to the photo layer itself so if I move the photo the mask moves with it. What I want to do is set up a mask as a separate layer and have it affect any layer below it. (Or even better - only 1 layer below it).
    I'm pretty sure this is possible and I think I've done it before, I just forget how.
    Thanks!

    Just turn off the link between the layer and the mask.

  • Why doesn't Photoshop always generate a layer mask

    I believe it was in CS4 that Adobe expanded the use of automatic layer masks ... perhaps it was with adjustment layers (I'm not quite sure)
    I don't know about others, but it would save me considerable time in the long run if every new layer, (whether it is generated as a copy, from a plug-in, as a cut, or as a new blank layer) recevied an automatic layer mask. It takes no file space, but more often than not I find myself needing one. It sure would be nice to jump right into masking rather than having to first create the layer mask. Why did they stop at adjustment layers?
    Am I alone in this?
    thanks

    Adding layers like Text, Raster and smart objects never have had automatic layers mask added.  Adding adjustment layers always came with an automatic layer mask until CS4.  Adode introduced bugs in CS4 when they added the adjustment panel these bugs have been carried forward into CS5 and CS6. Adobe added two options in the adjustment panels fly-out panel.  These options are designed to be global, not just adjustment panel options.  These options only work sometimes when changed from their default settings.  When changed from their default settings they try to change Photoshop historic default operation.  When you change Photoshop default operation Action, Scripts and Plug-ins that add adjustment layers may not work correctly.  Adobe should fix Photoshop and remove the two bad Adjustment Panel fly-out options. The Adjustment Panel fly-out menu option to not add Layer masks can not be safely set, same goes for the option to always clip added layer mask, if you use Actions, Scripts and Plug-ins that add adjustment layers.

  • Inverted layer mask not working

    I havent used PS much of late but in CS6 when layer masking the technique I used to use doesnt seem to work anymore.  I would have two layers.  The top layer I would put a layer mask.  Then I would select all and delete hit the delete button so the mask would turn black and invert.  Then instead of painting black over white to reveal the bottom layer I would paint white over black to bring my top layer back.  I liked doing it like this.   But its not working now.   When I paint with white on the black mask nothing happens?? I tried inverting in the properties but makes no diff.   What am I doing wrong?

    Check the blending mode on your brush.  It may be set to darken or some other blend mode than normal.  As a side note, you can invert a layer mask be making sure it's selected and press ctrl/cmd-i. You can also create a mask where everything is hidden by pressing alt/opt then clicking on the add layer mask icon in the layers pallet.

  • I can't get Layer Masks to work with PScc but works fine with CS6

    When I create a layer mask it shows up properly but doesn't work at all.  I have the correct layer selected and I'm painting in black (and nothing happens in white either) and there is no problem when doing exactly the same thing with CS6 so I thought there might be a difference in my settings but I can't see any.  My masks are NOT disabled in properties.  Nothing shows up on the image nor on the mask.  I can however, use the eraser tool as normal.  Any ideas?
    Thanks!

    PLease could you help me too.  I have been onto support through several emails and online helps and they do not understand the problem correctly and have not resolved it.  I have photoshopcc 2014.  If I click on add layer mask icon I get a white thumbnail.  That seems ok.  I then select a brush - set to normal etc.  all ok.  Then I attempt to either brush in or out on my photo to reveal or hide bits of layer below and it no longer works.
    Weirdly, I noticed it was not selected in channels.  So I checked the layer mask in channels and then back in layers it works except now it works by painting on a rubylith (which it did not do before 2014 version) then when I am done if I click apply mask everything works ok and it is done.  It just does not work unless I select in channels.
    This also happens if I apply an adjustment layer.  The adjustment comes into the thumbnails with a mask and the mask is unselected in channels, I have to select and it paints a ruby lith.
    If I go to layers in the menu however and select layer mask hide all or reveal all then select my brush it works fine and as it normally did before.
    I have tried re installing etc. and every bit of normal advice but nothing works.  Can you help or do you know anyone who can.  As I am desperate here is my email: [email protected]
    thank you

  • Paint brush not working on layer mask

    This is a totally novice question, but...
    When working with a layer mask, my paintbrush isn't showing up on the image. I can see the brush strokes on the layer mark in the layers sidebar, but no brush strokes on the image itself.
    I know it's just me doing something wrong...can anyone tell me what it is?

    I think you are not understanding how layers and layer masks work.
    Look at the following illustration.  The layers panel shows that the left of the image (The right is simply to make room for the layers panel and should be ignored) has solid blocks of red, green and blue.  The layer mask in the top layer (red) has a black rectangle which conceals that area of the layer, revealing the underlying layer.
    The mnomic we use is 'Black conceals and White Reveals'  So where the layer mask is white, the corresponding area in the layer can be seen, and where black, it is like a window looking through to the layers below.
    The Green layer also has a (smaller) black rectangle, so we can see the blue layer below that.
    The blue layer has an even smaller rectangle so we can see the checker board background which indicates transparency.
    Understanding Layer Masks In Photoshop

  • Need help translating PS Bloom Tutorial to Elements 8 ~ layer mask

    http://photoshoptutorials.ws/photoshop-tutorials/photo-effects/bloom.html
    I'm having difficulting translating this PS tutorial into Elements.  Could someone familar with elements please take a look at the tutorial and offer guidance?
    Thanks in advance!
    Credo

    Yes, see if the following gives the results your looking for:
    1. Steps 1 and 2 are the same.
    2. The part where it says add layer mask, click on the background layer and
        add an levels adjustment layer. (Layer>New Adjustment Layer>Levels)  Click on layer 1 and select group with previous.
        (Layer>Group with Previous or Add Clipping Mask)
    3. Steps 3 and 4, instead of apply image, click the eye icon on the levels layer to make
       the levels layer and layer 1 not visible.
      Click on the background layer and then do a select all, copy. (Select>All) then (Edit>Copy)
       Alt-click the levels mask and paste (Edit>Paste)  (a grayscale image will be pasted into the mask).
       Deselect (Select>Deselect).
    4.  Step 5 is the same.
    5. Steps 6 and 7, click on layer 1 to make it visible and then click the levels layer mask
        to make the mask active, Then run the gaussian blur filter on the mask.
    6. Step 8 is the same.
    Hope this helps.
    MTSTUNER

  • PSE 6 Layer Mask & OS 10.6.2

    I'm looking to add layer mask capability to PSE6 on a mac with Snow Leopard and have seen the download from here:
    http://graphicssoft.about.com/od/pselements/qt/layermasktool.htm
    but the instructions specifically reference OS 10.4 and 10.5 but not Snow Leopard:
    "Mac Installer: Download and Run Layer_Mask_Tool.dmg for Mac OS 10.4 and 10.5. Special thanks to Andrew Bartlett for creating the installer package for Macintosh."
    Can anyone confirm if this does/doesn't work with Snow Leopard?  Is there another solution for OS 10.6?
    thanks

    As Barbara says. This may also help.
    http://easymactips.blogspot.com/search?updated-min=2009-01-01T00%3A00%3A00-05%3A00&updated -max=2010-01-01T00%3A00%3A00-05%3A00&max-results=30

Maybe you are looking for

  • My computer crashed.  I backed up everything on an external drive.  How do I get the backup of itunes and all my music back on my new computer?

    My computer crashed.  I had everything backed up on an external drive.  I have a new computer.  How do I get itunes back on my new computere from the external drive?

  • Cover/Case for 13" Late 2008 Aluminum MacBook?

    I have a 13" late 2008 aluminum MacBook and am trying to find a cover/case (preferably the hard shell) that will fit it. I read that they are no longer made for this model so it will be hard to find. The websites I found that offer cases for this mod

  • Reset the Spry Validation List after sending

    <!-- I ADDED THIS FUNTION TO RESET THE FORM function afterSend(){    document.getElementById("From:").value="";    document.getElementById("email:").value="";    document.getElementById("Subject:").value="";    document.getElementById("Message:").val

  • SAP Content Server

    Dear Experts, I got problem in installing SAP Content Server 6.30 in Solaris 9 (Unix-SPARC 64bit). After discus with OSS they sugest to review the Apache installation, i try to follow the OSS note number 664384, but i confused with some error about t

  • Itunes resets Date Added

    My computer turns off by itself quite a lot and sometimes my library has to be recovered if I was using Itunes when it happened. It usually all comes back but sometimes it resets the Date Added on all songs and it's so frustrating because that's one