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
Get Clipping Path (as opposed to applying it)
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Get Clipping Path (as opposed to applying it)
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
identify -verbose yourimage
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Get Clipping Path (as opposed to applying it)
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
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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Get Clipping Path (as opposed to applying it)
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
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)
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
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
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Get Clipping Path (as opposed to applying it)
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...
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
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
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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Get Clipping Path (as opposed to applying it)
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
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
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Get Clipping Path (as opposed to applying it)
Sorry I am not sure about that. I don't use an actual API very often.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/