Hey all, my needy self is back to ask if anyone has heard of or attempted a script that will offset a path in the same way Illustrator does. ?
I have a group of images with clipping paths penned too much to the outside of the image edge, which will result in the "halo" effect when pasting into InDesign. Currently, I'm copying the path into Illustrator, using Offset Path with a negative value, then pasting back into PS, deleting old clipping path, and saving.
Thanks in advance for any help!
Yep Mark that's an option, but it's not much faster than the copy/paste method I'm using since multiple images' clipping paths can't be insetted at once in ID. Also, the original images would still be left with an incorrect path. Many times I'll need to run a batch in PS converting these images to tiff files, so then I'm still left with the "haloing" problem when finished. But thanks anyway, I can use that ID inset option for a few of them in a tight spot.
The problem is script has no idea of how much halo you get in id… Relative to the scaling factor. At leat you can preview the result doing this in ID. You can't adjust an existing path item in PS just read out the data then create a new path with math your adjustments… If you search the forums you won't find much regarding bézier math and ExtendScript. I've tried to get my head around this with AI scripting and failed miserably on several occasions… ![]()
If you are going to try this in PS then a few things I would add… Path Items I recall are one of the PS items that presume 72dpi so change image res while trying to work them then put back res… Making path from selection is not going to cut it ( well doesn't for me ) I wouldn't make selection from path, contract, make new path and remove old… If you manage it, do post your findings I may be able to utilize myself
… nothing like cheek…
I agree with Mark, the main problem I see is the script has no way of knowing if the path is off or by how much. And as he pointed out there is no easy way( that I know of ) to preview a clipping path in Photoshop.
Having said that if it just a matter of scaling down the size of the path to correct for the 'too much to the outside of the image edge' that is easy to script if you can figure out the scale amount.
Hey Michael, thanks for chiming in..
As far as the scale amount needed, the good thing is, it would be exactly the same for every image. So, I'd say a path inset of 1%, 1 pixel, or 1 or 2 pts would work great for all of my images across the board. That's why I mentioned that ID wouldn't need to know where the edges are at all. So you say this script would be simple?
Yes Mark you're correct. What I'm working with is hardware images that have been clipped incorrectly. Hinges, pulls, knobs.. etc.. so yes, some have screw holes and what not that probably have compound paths. However, so far I've found that the add and subtract parts of the clipping paths are kept separated and not combined in a a compound path at all, which still works in ID of course.
The task would seem to be a complicated one to me indeed.
It would be possible to determine the direction of a path at the position of a curve pathPoint and »move the point« some distance angled 90˚ relative to that, but with corner points there are problems (compare the Corner > Miter etc.-settings in Illustrator).
The amount by which the bezier handles of the offset points would have to be shortened or lengthened and, even worse, where additional points would have to be introduced make it even more complicated.
If the script were possible, or existed, it would just need to be written for PS only.
A BridgeTalk-Script handing the path’s information over to Illustrator, editing it there and passing it back would probably be easier.
I have looked into the very same issue some time back… Like I said my math skills failed me but thats not to say it can't be done… AI would be a no go from the point you would need to do the same thing there. No built in commands for insetting/offsetting and path items… As of CS6 it may be possible but a hassle still ( you can now evoke menus and run actions )… When I searched I could find almost nothing in ExtendScript… I would suspect that developers of this kind of stuff would use C++ ( is that right for plug-ins? ) and not be willing to share such hard work… I found stuff in other languages but I couldn't translate…
Illustrator team I would use that term lightly…
OK, I may have done somebody a disservice by not trying to find out how many people at Adobe are actually involved in developing Illustrator … I just assumed the number would justify the term »team«.
Is there anything we should know about? (Not that this is the place or you would be likely to be at liberty to divulge any information you may have beyond what a quick googling did find – pretty much nothing.)
Apparently people doing CNC milling have need for such things too:
e.g. http://www.cnczone.com/forums/coding/73975-offset_algorithm.html https://github.com/Heeks/libarea/blob/master/kurve/offset.cpp
These might be a clearer place to start:
http://cagd.cs.byu.edu/~557/text/ch8.pdf
http://www.cis.usouthal.edu/~hain/general/Publications/Bezier/Bezier%2 0Offset%20Curves.pdf
http://www.cis.usouthal.edu/~hain/general/Publications/Bezier/BezierFl attening.pdf
http://stackoverflow.com/questions/408457/outline-of-cubic-bezier-curv e-stroke
North America
Europe, Middle East and Africa
Asia Pacific