potential bug -alpha off ... -alpha on IM 7

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: 24024
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

potential bug -alpha off ... -alpha on IM 7

Post by fmw42 » 2018-10-08T16:21:59-07:00

This command works fine in IM 6.9.10.12 Q16 Mac OSX.

Code: Select all

convert icon.png -alpha off -fuzz 50% -fill "#550000" -opaque "#000000" -alpha on icon2.png
But fails in IM 7.0.8.12 Q16 Mac OSX Sierra.

Code: Select all

magick icon.png -alpha off -fuzz 50% -fill "#550000" -opaque "#000000" -alpha on icon2.png
Images and reference discussion at https://imagemagick.org/discourse-serve ... =1&t=34834

It does work in IM 7 using -channel RGB rather than -alpha off

User avatar
magick
Site Admin
Posts: 10849
Joined: 2003-05-31T11:32:55-07:00

Re: potential bug -alpha off ... -alpha on IM 7

Post by magick » 2018-10-09T16:41:21-07:00

ImageMagick 7 has variable channels per https://imagemagick.org/script/porting.php. When you turn alpha off, the alpha channel is tossed. When you re-enable, it adds back an opaque alpha channel. ImageMagick 6 is different, the alpha channel persists when it is turned off and restored when it is turned back on. What you want instead is to deactivate the alpha channel instead of turning it off, use -alpha Deactivate. Deactivating persists the alpha channel but does not use it for blending pixels for certain image processing options.

snibgo
Posts: 10857
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: potential bug -alpha off ... -alpha on IM 7

Post by snibgo » 2018-10-09T16:48:25-07:00

Perhaps in v7, "-alpha Deactivate" and "-alpha Activate" do what "off" and "on" did in v6.
snibgo's IM pages: im.snibgo.com

User avatar
fmw42
Posts: 24024
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: potential bug -alpha off ... -alpha on IM 7

Post by fmw42 » 2018-10-09T18:05:13-07:00

snibgo wrote:
2018-10-09T16:48:25-07:00
Perhaps in v7, "-alpha Deactivate" and "-alpha Activate" do what "off" and "on" did in v6.
Yes, that works. Thanks, snibgo.

This needs to be documented in the Porting doc page. I do not see -alpha activate/deactivate listed there.

Post Reply