Page 1 of 1

possible bug -poly with alpha channel IM 6.8.5.4

Posted: 2013-05-04T18:13:15-07:00
by fmw42
In response to viewtopic.php?f=1&t=23342

There may be a bug in alpha processing with -poly.

This is just making the image transparent where white:

convert logo: -transparent white show:


This does the same and applies -poly as a no-op, e.g. wt=1 and exponent=1. But it has preserved the white and made the rest transparent. That is, it seems to negate the alpha channel.

convert logo: -transparent white -poly "1,1" show:

This does the same even with -channel rgba applied:

convert logo: -transparent white -channel rgba -poly "1,1" show:


I never gave any thought to transparency with -poly when I proposed it, especially when multiple images are involved. But I do not think it should negate the alpha channel.

This seems to show that the result gets the alpha channel (although negated) from the first image. The third example has no alpha channel.

convert logo: logo: -transparent white -poly "0.5,1 0.5,1" show:
convert \( logo: -transparent white \) logo: -poly "0.5,1 0.5,1" show:
convert logo: \( logo: -transparent white \) -poly "0.5,1 0.5,1" show:

This seems to show that the alpha channel is processed by the exponent as well as negated. Compare these. They show different alpha channels.

convert -size 256x256 gradient: \( -clone 0 \) -alpha off -compose copy_opacity -composite -poly "1,1" -alpha extract show:
convert -size 256x256 gradient: \( -clone 0 \) -alpha off -compose copy_opacity -composite -poly "1,3" -alpha extract show:

Just trying to understand what is happening with the alpha channel with -poly. Perhaps it should only process the alpha channel if using -channel rgba.

Re: possible bug -poly with alpha channel IM 6.8.5.4

Posted: 2013-05-05T12:30:23-07:00
by magick
We can reproduce the problem you posted and have a patch in ImageMagick 6.8.5-5 Beta available by sometime tomorrow. Thanks.