Re: Clipping path?

Bob Friesenhahn <[email protected]> Mon, 20 Jun 2011 09:05:30 -0500 (CDT)
Newsgroups gmane.comp.video.graphicsmagick.tools
Message-ID <[email protected]>
On Sun, 19 Jun 2011, Ian Zimmerman wrote:

> Here's a bit of the gm manpage (this option would apply to the mogrify
> and convert subcommands, at least).
>
> -clip  apply the clipping path, if one is present
>
>        If a clipping path is present, it will be applied to subsequent operations.
>
>        For example, if you type the following command:
>
>             gm convert -clip -negate cockatoo.tif negated.tif
>
>        only the pixels within the clipping path are negated.
>
>        The  -clip  feature  requires the XML library.  If the XML library is not present, the
>        option is ignored.
>
> But but but ...
>
> First, what is the "XML library", how do I know if it is present and
> where do I get it if not present?

You can learn the features built into GraphicsMagick by executing 'gm 
-version'.  If libxml2 is linked in, then the 'XML' property will be 
listed as 'yes'.

> Second, what kind of thing is the clipping path?  A file - what file?
> Environment variable?  Or what?  What information should be inside the
> thing and in what format?

It seems that the clipping path can be in the format specified by 
either the Postscript v3 specification or the SVG specification.  It 
also seems that the clipping path is most often obtained from the 
'8BIM' profile which is often embedded in JPEG or TIFF files, but may 
also be embedded in an SVG file.

> I suspect this bit has been mindlessly (or automatically) copy-pasted
> from the API docs without considering the specific situation of the
> command-line tool user.

There is no doubt that using the API provides more power, but it is my 
understanding that this feature exists to apply existing clipping 
paths to an image, similar to what Photoshop does.  The person who 
implemented the code intended to use it from the command line.

If you are looking for a general purpose mechanism which may be used 
as part of image processing, then see the documentation for the -mask 
option which alows creating an arbitrary mask using a similar-sized 
image file.

Bob
-- 
Bob Friesenhahn
[email protected], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev