Page 1 of 1

Possible bug with -compose Dst-Out -composite

Posted: 2019-01-11T08:10:34-07:00
by drdaanger
Version: ImageMagick 7.0.8-16 Q16 x86_64 2018-12-10 https://imagemagick.org
MacOS 10.12.6

Command:

Code: Select all

magick -size "120x120" xc:white \( -size "120x120" xc:none -fill black -draw "circle 60,60 60,10" \) -alpha Set -compose Dst-Out -composite round_mask.png
Expected result: A white background with a transparent circular cut-out in the middle.
Actual result: A white background with a transparent circular cut-out in the middle bordered with semi-transparent black:
Image

Came across this in a few iterations. I can't shake the semi-transparent black border when trying to use a simple shape as a mask to cut out a background. The example I presented is the bare-bones version. I'd be happy to learn I'm doing something wrong. This is based on the example from https://www.imagemagick.org/Usage/compose/#dstout. I still get the semi-transparent background even with a straight copy-paste from the last example given.

Re: Possible bug with -compose Dst-Out -composite

Posted: 2019-01-11T08:41:27-07:00
by snibgo
The documentation hasn't been updated for V7. I suggest you limit the "-composite" operation to the Alpha channel only. Like this:

Code: Select all

magick -size "120x120" xc:white \( -size "120x120" xc:none -fill black -draw "circle 60,60 60,10" \) -alpha Set -channel A -compose Dst-Out -composite +channel out.png

Re: Possible bug with -compose Dst-Out -composite

Posted: 2019-01-11T09:17:34-07:00
by drdaanger
Bingo! So, is what I found considered a "bug" with specifying the alpha channel as a workaround or is what I found an actual bug? My impression of DST OUT is that it should just be a destination with multiplied alpha channel from source.

Re: Possible bug with -compose Dst-Out -composite

Posted: 2019-01-11T09:30:04-07:00
by snibgo
drdaanger wrote:My impression of DST OUT is that it should just be a destination with multiplied alpha channel from source.
That is also my impression, but I would have to carefully read SVG documentation to be sure. So, yes, I think you have found a bug in v7, and my workaround shouldn't be needed.