11 Replies Latest reply on Sep 13, 2016 7:43 AM by JJMack

    Layer Mask Replacement automation

    Vfxvenkat98 Level 1

      Hi,

           In a document i am having 2 different layer masks.one is inner,and another is outer mask.and also the document has more than5 layer group folder inside that folder there are two sub groups as(inner,outer)

      How to replace the same masks which stored in channels into all matching layers.

      For example in channels panel inner,outer mask is available

      and also in document all the 10 layer groups has two layers which are named as inner and outer.

      Finally the layer name matches to channel mask it need to replace by its mask for all the layers.

       

      Does this possible

       

      Thanks in advance.

      2016-09-06.jpg

        • 1. Re: Layer Mask Replacement automation
          JJMack Most Valuable Participant

          If you have a document like you show and all layer groups are like the three you show open. Two Adjustment layers with outer on top of inner.  You should be to replace the two Alpha channels inner and outer then loop through the documents layer groups  where you delete the existing layer mask and add the new inner and outer alpha channels as layer mask.  The layer names in the groups would not need to be inner and outer,  They could have unique names that reflect the adjustment layer type. What would be important is important is the position with in the layer group stack.  Two layer only in each layer group where outer is on top of inner in the layer stack.

          • 2. Re: Layer Mask Replacement automation
            Vfxvenkat98 Level 1

            yes Mack it is possible with action but i cant able to automate for all groups in the document in a single click.

            • 3. Re: Layer Mask Replacement automation
              JJMack Most Valuable Participant

              You have lost me we are in the scripting forum. It is possible with a Photoshop Script.

               

              If your documents will always  have 10 layer groups with the same group and layer names it may be possible to record an action to replace all 10 layer groups layers layer masks. With duplicate layer names it may not be possible.  If a action target a layer by name outer and there 10 layers with the name outer which layer would be targeted.

               

              If your documents layer groups all have the same structure a script could process all the document layer groups. No matter how many layer groups your documents have.   If you have layer groups with different structures a script could be coded to process layer groups with some kind of naming convention that identifies group structure. And process different structured layer groups.

               

              Scripts can use logic.  Actions can not and the will only work correctly on document that they are recorded to process.  If an action depends on a document having a particular structure if a document does not have that structure the action will fail if played on that document.

               

              Scripts are programmed using a supported scripting language.

              • 4. Re: Layer Mask Replacement automation
                Vfxvenkat98 Level 1

                but i am new to scripting does anyone give me a help on this for the script

                • 5. Re: Layer Mask Replacement automation
                  JJMack Most Valuable Participant

                  Do you have any programming skills? Do you know JavaScript? Do you  know Photoshop well? You also need the learn about Action Manager code and Adobe's Scriptlistener Plug-in.  Here is a link to Adobe Photoshop Scripting information. http://www.adobe.com/devnet/photoshop/scripting.html

                   

                  Here is a Photoshop JavaScript outline for processing all layers in a document.  If you do not understand it.  I would suggest you take some lesson on scripting Photoshop.

                   

                  #target photoshop

                  app.bringToFront();

                   

                  if (!documents.length) { alert('There are no documents open.', 'No Document');}

                  else {processArtLayers(activeDocument);}

                   

                  function processArtLayers(obj) {

                      for( var i = obj.artLayers.length-1; 0 <= i; i--) {

                           If  (obj.artLayers[i].kind = is the kind of layer you want to change) {

                                change the layer;

                                }

                           }

                      for( var i = obj.layerSets.length-1; 0 <= i; i--) {processArtLayers(obj.layerSets[i]); } // Process Layer Set Layers

                  }

                   

                   

                  • 6. Re: Layer Mask Replacement automation
                    Vfxvenkat98 Level 1

                    For instance if a image has same group names in all layer groups is there any method to copy the layer mask from any group and paste that masks into all matching groups.

                    for example.

                    Group 1 layer has 5 masks (which named as 1,2,3,4,5.)

                    And in the same document there are some twenty layer groups is there

                    i want to copy the layer mask from (1,2,3,4,5) groups and paste into all the above layer Groups which matches to (1,2,3,4,5).

                    all the time manually by (alt+click) and drop in the layer groups.

                    • 7. Re: Layer Mask Replacement automation
                      Vfxvenkat98 Level 1

                      Please tell me some solution for this Thanks in advance

                      • 8. Re: Layer Mask Replacement automation
                        JJMack Most Valuable Participant

                        It is a matter of locic if the program logic is correct it should work. If the document is also correct.

                         

                        Is this logic good what does it mean? "For instance if a image has same group names in all layer groups"

                         

                        "Group 1 layer has 5 masks (which named as 1,2,3,4,5.)"

                         

                        Do layer mask have names and do layer have names ahoe doe you handle duplicate layer names 

                        If all thing in the document are correct and the logic is correct the script should work.

                         

                         

                         

                         

                        Capture.jpg

                        Capture.jpg

                        • 9. Re: Layer Mask Replacement automation
                          Vfxvenkat98 Level 1

                          as said in that above example i want to express that task

                          • 10. Re: Layer Mask Replacement automation
                            Vfxvenkat98 Level 1

                            but in my case always layer mask are thee to proceed group 1 has all parent masks but all the group 1 copy group 2 copy has no mask so the script needs to take layer masks from its parent and paste into all the above child's

                            • 11. Re: Layer Mask Replacement automation
                              JJMack Most Valuable Participant

                              Post your script code so we can see it.