Skip to main content
Known Participant
June 11, 2011
Answered

Creating a Vector Mask from a Path

  • June 11, 2011
  • 1 reply
  • 1963 views

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!

This topic has been closed for replies.
Correct answer Muppet_Mark-QAl63s

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 reply

Muppet_Mark-QAl63s
Muppet_Mark-QAl63sCorrect answer
Inspiring
June 11, 2011

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…

Known Participant
June 11, 2011

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

Muppet_Mark-QAl63s
Inspiring
June 11, 2011

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