-
1. Re: Help change script from Alpha Channel to Photoshop path
-hans- Feb 8, 2013 2:12 PM (in response to erblo007)Hi,
it should be simply:
aImageReference.clippingPath.appliedPathName = 'Path 1'; "include inside edges" and tolerance/threshold values -> Valid only when clipping type is alpha channel or detect edges.
-
2. Re: Help change script from Alpha Channel to Photoshop path
erblo007 Feb 8, 2013 2:52 PM (in response to -hans-)Thanks for your reply. So I would replace 'ALPHA_CHANNEL' with 'PHOTOSHOP_PATH'. This line of code you sent, where does this fit into my code listed above?
Also, I need to work with both Alpha and PS Paths, so I do need to include inside edges. How can I add that?
-
3. Re: Help change script from Alpha Channel to Photoshop path
-hans- Feb 9, 2013 2:10 AM (in response to erblo007)Hi,
it's not quite clear what your workflow should look like.
So here are just the two examples of how to handle a Photoshoppath (currently on) and alphachannel (currently off).
Assume a image selected:
var currSel = app.selection[0]; (currSel instanceof Image) ? processPath(currSel) : alert('Selection is not a picture.'); //(currSel instanceof Image) ? processAlpha(currSel) : alert('Selection is not a picture.'); //Process a photoshoppath function processPath(aImageRef) { pathNames = aImageRef.clippingPath.photoshopPathNames; pl = pathNames.length; while(pl--) { if (pathNames[pl] == 'Path 1') { aImageRef.clippingPath.appliedPathName = 'Path 1'; alert('Applied Photoshoppath Path 1'); exit(); } } } //process a alphachannel function processAlpha(aImageRef) { //there may be zero to ++ alphachannels, just choosed the first here var alphaChannelName = aImageRef.clippingPath.alphaChannelPathNames[0]; (alphaChannelName != undefined) ? setAlphaChannel(aImageRef, alphaChannelName) : alert('No Alphachannel avaiable.'); exit(); } //apply settings for alphaChannel function setAlphaChannel(aImageRef, alphaChannelName) { with (aImageRef.clippingPath) { appliedPathName = alphaChannelName; includeInsideEdges = true; threshold = 30; //number (range: 0 - 255) tolerance = 3 ; //number (range: 0 - 10) restrictToFrame = true; invertPath = false; insetFrame = '5 pt'; } alert('Applied Alphachannel: ' + alphaChannelName); exit(); }Happy scripting
Hans-Gerd Claßen
-
4. Re: Help change script from Alpha Channel to Photoshop path
erblo007 Feb 15, 2013 3:25 PM (in response to -hans-)Thank you for the help, I tried using this script and I got the message 'selection is not a picture'.
I made a sample layout of what I'm trying to do. I need to be able to select both pictures at the same time, run the script and get the result shown below.
https://www.dropbox.com/s/u3oxbqcpfnkp0n3/sample.indd
The script I posted at the top does everything I need, except it does not include the inside edges.
-
5. Re: Help change script from Alpha Channel to Photoshop path
-hans- Feb 16, 2013 1:16 AM (in response to erblo007)Hi,
my example code expects a image to be selected ... not a graphic frame.
If you spend a bit of your time inspecting it, you'll see that you've got everything to solve your issue either using alpha channel or photoshop path.
Give it a try!
P.S. One tipp: Guess you can forget about the alphachannel as the images have got a photoshop path, which is more accurate -> results would be better.

