3

I am working with some large tiff files with fairly complex clipping paths, and have written a script to convert the paths 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?

Thanks

  • What's the advantage of scripting this over an action then? I use an action very similar on product photos for ecommerce. Works great. – cclark413 Apr 27 '14 at 3:34
  • No advantage to scripting, I suppose. Bothered that scripting couldn't handle something that manual input (and actions) can. I was sort of preoccupied with using a selection when a vector mask would do -- I found a script that converts a path to a vector mask, and guess what? It uses actions to do its work. – dodorkahedron Apr 27 '14 at 5:31
  • if you want your script debugged you should include relevant parts. are you sure tour manual input makes a 1000 points – joojaa Apr 27 '14 at 14:12
  • If Photoshop can be trusted to report the number of points accurately (via an alert() statement), then yes, I'm certain it fails after 1000 points -- unless by manual input or Action execution. It seems I've encountered an inexplicable upper limit on path complexity that doesn't exist when approached via other means. I'll include the code below, though I've abandoned it in my project. I've decided to use a vector mask rather than a selection, since that so far has worked regardless of path complexity. – dodorkahedron Apr 27 '14 at 17:43
  • Sorry...I have to read up on posting code here...new to forums var docRef=activeDocument; var thePath=docRef.pathItems[0]; thePath.select(); var totalPoints = thePath.subPathItems[0].pathPoints.length; var x=0; var anchorList=new Array; for(x=0;x<totalPoints;x++) { anchorList[x]=new Array; anchorList[x] = thePath.subPathItems[0].pathPoints[x].anchor; } alert(anchorList); var myLayer=docRef.layers.getByName("artLayer"); docRef.activeLayer=myLayer; var selectIt=docRef.selection.select(anchorList); – dodorkahedron Apr 27 '14 at 17:43
1

The code you pasted didn't work for me either so I wrote this.

var docRef=activeDocument; 
var thePath=docRef.pathItems[0]; 
thePath.select(); 
thePath.makeSelection();

It worked for me hope it works for you too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.