Skip to main content
April 26, 2014
解決済み

Scripting: upper limit on number of points in clipping path to be converted to selection?

  • April 26, 2014
  • 返信数 1.
  • 597 ビュー

Greetings,

I am working with some large tiff files with fairly complex clipping paths, and have written a script to convert a path to a selection, invert that selection and delete pixels in order to downsample and save a PNG with transparent background for the web.

If the number of points in the clipping path is greater than 1000, Photoshop will stop with an "Illegal Argument" message and will not make the selection. Choosing "Make Selection..." manually from the path palette works fine, and works almost instantly.

The problem is especially frustrating since the manual selection is made so easily.

Does anyone know how to allow more points or override this limit? I'd also experiment with a scriptable command to arbitrarily simplify the path if there's no way around the problem at hand.

Thanks

このトピックへの返信は締め切られました。
解決に役立った回答 Chuck Uebele

When you say clipping path, do you mean a vector path to a layer?  Is the clipping path all ready created in the document, or are you creating it via script?  If you just want to create a png, and it's a vector mask, can't you invert the vectore mask and or copy it to whatever layer you want to clip, then resize?  You don't need a flattened image to create a png. 

返信数 1

Chuck Uebele
Community Expert
Chuck UebeleCommunity Expert解決!
Community Expert
April 26, 2014

When you say clipping path, do you mean a vector path to a layer?  Is the clipping path all ready created in the document, or are you creating it via script?  If you just want to create a png, and it's a vector mask, can't you invert the vectore mask and or copy it to whatever layer you want to clip, then resize?  You don't need a flattened image to create a png. 

April 27, 2014

The clipping paths were already saved in the files. Their purpose in print, in this case, is the same as for the web -- eliminating the background -- and so I don't need to invert it (easier than my original intention of converting the path to a selection).

I looked around and found a function that converts a path to a vector mask, so I used that. It's easier, faster and less code than what I was working with. I was preoccupied with using a selection, when a vector mask would do fine, and in fact led to a faster and easier script. Thanks for pointing me in the right direction!

Chuck Uebele
Community Expert
Community Expert
April 27, 2014

Great!  We all get locked into one direction at times.  I know I do.  Glad it worked out.