Page 1 of 1
Get Clipping Path (as opposed to applying it)
Posted: 2011-08-30T07:56:15-07:00
by lavie
I've already figured out how to apply a clipping path embedded in the image file, using the "-clip" option.
My quesion is: is there a way to extract the clipping path - either as a memory struvture, stream, file, etc in some easily understood format (preferably an array of Bezier curves).
TIA
mlavie
Re: Get Clipping Path (as opposed to applying it)
Posted: 2011-08-30T10:01:26-07:00
by fmw42
I have no experience with clip paths. But you might look at the verbose information for your image to see if it contains the clip path.
identify -verbose yourimage
Re: Get Clipping Path (as opposed to applying it)
Posted: 2011-08-30T16:57:17-07:00
by anthony
The clip path is just a SVG path in the image meta-data. Identify with verbose should report it.
However the -clip is only used as a bitmap image (50% thresholded).
What little notes I have on it is in
IM Examples, Masking, Clipping Masks
http://www.imagemagick.org/Usage/maskin ... ping_masks
Re: Get Clipping Path (as opposed to applying it)
Posted: 2011-08-30T23:04:00-07:00
by lavie
Hi Anthony,
Would the command you give (verbose) just give the name of the clipping path, or would it extract the actual array of Bezier curve points from the Adobe 8BIM clipping path?
TIA,
Lavie
Re: Get Clipping Path (as opposed to applying it)
Posted: 2011-08-30T23:24:46-07:00
by lavie
OK - I just tried this, and I am getting what appears to be an array of points, I assume that this is the info I need.
However, I want to access this info via an API from a lib linked into my code, and not via command-line, which would be grossly inefficient for large volumes of SVG extraction. how would I go about that?
TIA,
mlavie
Re: Get Clipping Path (as opposed to applying it)
Posted: 2011-08-31T01:30:53-07:00
by anthony
A SVG path can consist of an array of points, but not just points on the path ('knots' points) but also various control points to define the bezier curves also should contain some letters.
Something like...
Code: Select all
M 12,27 C 7,37 18,50 18,60 S 0,80 10,94
S 40,74 50,78 S 60,99 76,95 S 72,70 75,65
S 95,55 95,42 S 69,37 66,32 S 67,2 53,7
S 43,17 35,22 S 17,17 12,27 Z
The meaning of the letters is explained in
IM Examples, Drawing, SVG
http://www.imagemagick.org/Usage/draw/#paths
Or a less easy to follow but official explanation in the SVG specification
http://www.w3.org/TR/SVG/paths.html#Pat ... nformation
Re: Get Clipping Path (as opposed to applying it)
Posted: 2011-08-31T01:54:00-07:00
by lavie
Hi Anthony,
I already managed to succeed with that - thanks for the "-verbose" tip.
How would I extract that same SVG info via an API call?
TIA,
mlavie
Re: Get Clipping Path (as opposed to applying it)
Posted: 2011-08-31T22:18:59-07:00
by anthony
Sorry I am not sure about that. I don't use an actual API very often.