make outside of path with id transparent - correct usage

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
zaratol
Posts: 43
Joined: 2010-04-21T08:30:43-07:00
Authentication code: 8675308

make outside of path with id transparent - correct usage

Post by zaratol »

Hi, i know this is really old topic, but currently i'm confused.

In ancient time like 2011 we had to use:
convert [input] +clip-path [id] -draw "color 0,0 reset" [output].

This changed sometime and we had Topic viewtopic.php?f=3&t=22081&p=91608&hilit ... ate#p91608
and Documentation http://imagemagick.org/script/command-l ... s.php#clip was changed accordingly.

So new commandline would look like:
convert [input] -clip-path [id] -negate -draw "color 0,0 reset" [output]

But in current release:

Code: Select all

convert --version
Version: ImageMagick 6.8.9-7 Q16 x64 2014-08-16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib cairo freetype jbig jng jp2 jpeg lcms lqr pangocairo png ps rsvg tiff webp xml zlib
i have to use +clip-path [id] again to get outside of path, did i miss a change?
zaratol
Posts: 43
Joined: 2010-04-21T08:30:43-07:00
Authentication code: 8675308

Re: make outside of path with id transparent - correct usage

Post by zaratol »

Current Result:
  1. * -clip -negate - inside of clipping path is transparent
    * -clip - inside of clipping path is transparent
    * +clip -everything transparent
    * -clip-path "#1" - inside of clipping path is transparent
    * -clip-path "#1" -negate - inside of clipping path is transparent
    * +clip-path "#1" -outside of clipping path is transparent
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: make outside of path with id transparent - correct usage

Post by snibgo »

I'm not sure what you are trying to do.

As I understand it (I could be wrong) the "+" versions turn off the clipping. Clipping is off by default, so they are pointless unless you have a preceding "-" version.

There isn't a simple method to activate a clipping mask but negate its effect. "-negate" will negate the image, and has no effect on the clipping mask.
snibgo's IM pages: im.snibgo.com
zaratol
Posts: 43
Joined: 2010-04-21T08:30:43-07:00
Authentication code: 8675308

Re: make outside of path with id transparent - correct usage

Post by zaratol »

Ok sorry i will give some examples
source Image: http://home.arcor.de/durius.obsidian/testcases/rgb.tif

convert -version
Version: ImageMagick 6.8.9-7

convert rgb.tif +clip-path "#1" -tile pattern:checkerboard -draw "color 0,0 reset" 6897_plus.jpg
Image

convert rgb.tif -clip-path "#1" -negate -tile pattern:checkerboard -draw "color 0,0 reset" 6897_negate.jpg
Image

I would have expected that with current version i would have to negate clipping path if i want to select outside of clipping path and that with +clip-path i would get full transparent image.

6897_plus.jpg shows the result i want, but i would have expected that i need different commandline
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: make outside of path with id transparent - correct usage

Post by snibgo »

You have two variables: "+" or "-", and "-negate" or no "-negate".

Testing these four variations with your file, IM v 6.8.9-5, "-negate" or not makes no difference. "+" or "-" makes the difference you show.

Which has blown my understanding and the documentation of what "+clip-path" does. (Being able to negate the clip path is useful, but I didn't think "+" would do it.)

Some with more knowledge than me would need to comment.
snibgo's IM pages: im.snibgo.com
zaratol
Posts: 43
Joined: 2010-04-21T08:30:43-07:00
Authentication code: 8675308

Re: make outside of path with id transparent - correct usage

Post by zaratol »

snibgo wrote: Which has blown my understanding and the documentation of what "+clip-path" does. (Being able to negate the clip path is useful, but I didn't think "+" would do it.)
mine too, because i'm pretty sure that once upon a time +clip behaved similiar as +clip-path now, thats why viewtopic.php?f=3&t=22081&p=91608&hilit ... ate#p91608
was posted as a bug. After reading that topic i got the impression i need to change my old scripts, because i use +clip-path in this way since like 2011 but did not update ImageMagick where this method is used.

I just now want to make sure i use the "correct" way to select outside of a clipping Path.
Post Reply