Possible bug with -compose Dst-Out -composite

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
drdaanger
Posts: 5
Joined: 2019-01-11T07:51:43-07:00
Authentication code: 1152

Possible bug with -compose Dst-Out -composite

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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
snibgo's IM pages: im.snibgo.com
drdaanger
Posts: 5
Joined: 2019-01-11T07:51:43-07:00
Authentication code: 1152

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

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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.
snibgo's IM pages: im.snibgo.com
Post Reply