3 Replies Latest reply on Jun 11, 2011 9:42 AM by Muppet Mark-QAl63s

    Creating a Vector Mask from a Path

    Squisterson Level 1

      How do I apply an existing path as a vector mask to an existing layer or a new solid color layer?
      Saying that... how do I do that manually?

      Thanks!

        • 1. Re: Creating a Vector Mask from a Path
          Muppet Mark-QAl63s Level 4

          Saying that... how do I do that manually?

           

          If you have a non-background layer as active then you can select the path and go menubar/layer/vector mask/current path… done…

           

          You can do the same with script like so…

           

          #target photoshop
          
          var doc = app.activeDocument;
          
          doc.pathItems.getByName('Work Path').select();
          
          pathtoVectorMask();
          
          doc.pathItems.getByName('Work Path').remove();
          
          function pathtoVectorMask() {
               function cTID(s) { return app.charIDToTypeID(s); };
               function sTID(s) { return app.stringIDToTypeID(s); };
          
                    var desc27 = new ActionDescriptor();
                    var ref11 = new ActionReference();
                    ref11.putClass( cTID('Path') );
                    desc27.putReference( cTID('null'), ref11 );
                    var ref12 = new ActionReference();
                    ref12.putEnumerated( cTID('Path'), cTID('Path'), sTID('vectorMask') );
                    desc27.putReference( cTID('At  '), ref12 );
                    var ref13 = new ActionReference();
                    ref13.putEnumerated( cTID('Path'), cTID('Ordn'), cTID('Trgt') );
                    desc27.putReference( cTID('Usng'), ref13 );
               executeAction( cTID('Mk  '), desc27, DialogModes.NO );
          };
          

           

          The above assumes… 1. you have a document open… 2. your active layer is NOT background 3. you have a path called 'Work Path'… there may be some other checks that you should make too…

          1 person found this helpful
          • 2. Re: Creating a Vector Mask from a Path
            Squisterson Level 1

            Sweeeet! Exactly what I was looking for. Dunno why I couldn't find it. Thanks!

            • 3. Re: Creating a Vector Mask from a Path
              Muppet Mark-QAl63s Level 4

              The only thing the script does different is I removed the original path after its duped to a layers vector mask…