[RESOLVED]possible bug disabling mask from -clip IM 6.8.0.0

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

[RESOLVED]possible bug disabling mask from -clip IM 6.8.0.0

Post by fmw42 »

see
viewtopic.php?f=1&t=22069&p=91269#p91269

It would appear that the use of -strip +clip-mask +mask is not disabling the mask created by -clip. The +clip form supposedly just negates the mask.

According to http://www.imagemagick.org/Usage/masking/#clip

"Note that the "+clip" operator negates the mask, it does not turn off and remove the clip mask. To turn it off you need to use "+clip_mask" instead."



Is this a bug or is there some other command that disables the masking from -clip?
Last edited by fmw42 on 2012-10-23T10:02:07-07:00, edited 1 time in total.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: possible bug disabling mask from -clip IM 6.8.0.0 Q16

Post by anthony »

The mask for clip will only be enabled when you use -clip before +strip.

in IMv6 the -clip or -clip-mask (boolean) is a separate mask to the more normal write -mask (grayscale). In IMv7 they are the same (whcih makes sense)
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug disabling mask from -clip IM 6.8.0.0 Q16

Post by fmw42 »

anthony wrote:The mask for clip will only be enabled when you use -clip before +strip.

in IMv6 the -clip or -clip-mask (boolean) is a separate mask to the more normal write -mask (grayscale). In IMv7 they are the same (whcih makes sense)

Sorry, I am not following the above.

How does that tell me how to use -clip, then disable it in the same command line so that the subsequent operations are global and not limited to the clip area.

How do I avoid having to use a pipe such as the following to convert the transparent background to white:

convert 1.psd -alpha transparent -clip -alpha opaque miff:- | convert - -background white -flatten 1test8.png


where the following does not work:

convert -respect-parenthesis \( 1.psd -alpha transparent -clip -alpha opaque -strip +clip-mask +mask \) \
-channel rgba -alpha on -background white -alpha background -compose over +geometry -flatten 1test2.png (or .jpg)
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: possible bug disabling mask from -clip IM 6.8.0.0 Q16

Post by anthony »

It should still unset the clip mask. that -clip set. If it isn't it is a bug.
I mentioned it because I discovered it from programming, and noted that you have to use the other to unset it
If it is not working, (and it should) then there is a bug about unsetting the clipmask from an image.

Hmmm...
quick test...

convert red_image.png -clip-mask write_mask.png -fill blue -opaque red \
+clip-mask -alpha transparent show:

Well the writable area was made blue, then transparent. but the unwritable area was not made transparent!
The result of the above should have been everything transparent, It wasn't.

Houston, we have a problem! this is a definite bug.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug disabling mask from -clip IM 6.8.0.0 Q16

Post by fmw42 »

anthony wrote: Houston, we have a problem! this is a definite bug.
Thanks for the confirmation.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug disabling mask from -clip IM 6.8.0.0 Q16

Post by fmw42 »

anthony wrote: Houston, we have a problem! this is a definite bug.

Here is a summary:

Using +strip +clip-mask +mask, I cannot disable the clip mask in the command line.

This works by piping the output to get rid of the clip mask:

convert 1.psd -alpha transparent -clip -alpha opaque miff:- | convert - -background white -flatten 1test10.png


This does not work:

convert 1.psd -alpha transparent -clip -alpha opaque -strip +clip-mask +mask -background white -flatten 1test2.png


Input is at:
http://www.dragoniadev.com/download/1.psd
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug disabling mask from -clip IM 6.8.0.0 Q16

Post by fmw42 »

The use of +clip does indeed remove the mask contrary to the Usage page that said it negated it. So the following does work.


convert 1.psd -alpha transparent -clip -alpha opaque -strip +clip \
-background white -alpha background -flatten 1test2.png
Post Reply