Page 1 of 1

FIXED: Gradient and alpha produces incorrect result.

Posted: 2012-12-29T19:18:39-07:00
by glennrp
There's something odd going on with gradient. In this test, all of the pixels
should have the same RGB color (0,.61680,0) while the alpha should
vary. In fact the bottom row has some all-black pixels.

This problem is observed with the current release, IM-6.8.1-5, Q8 and Q16.
  • convert -size 3x3 gradient:"#00f000ff-#00f00000" txt:-

    # ImageMagick pixel enumeration: 3,3,65535,srgba
    0,0: ( 0,61680, 0,65535) #0000F0F00000 srgba(0,240,0,1)
    1,0: ( 0,61680, 0,65535) #0000F0F00000 srgba(0,240,0,1)
    2,0: ( 0,61680, 0,65535) #0000F0F00000 srgba(0,240,0,1)
    0,1: ( 0,61680, 0,32767) #0000F0F000007FFF srgba(0%,94.1176%,0%,0.499992)
    1,1: ( 0,61680, 0,32767) #0000F0F000007FFF srgba(0%,94.1176%,0%,0.499992)
    2,1: ( 0,61680, 0,32767) #0000F0F000007FFF srgba(0%,94.1176%,0%,0.499992)
    0,2: ( 0, 0, 0, 0) #0000000000000000 none
    1,2: ( 0, 0, 0, 0) #0000000000000000 none
    2,2: ( 0,61680, 0, 0) #0000F0F000000000 srgba(0,240,0,0)
There are similar errors for other sizes, but it always seems to be in the bottom row.
For example, with "-size 10x8" there are 7 black pixels in the bottom row while all the
rest are correct. With "-size 100x3", there are 15 randomly scattered correct pixels
in the bottom row while all the rest are transparent black and all pixels in the other rows
are correct. In every case, alpha is correct.

Re: Gradient and alpha produces incorrect result.

Posted: 2012-12-29T21:25:49-07:00
by magick
The last pixel has an opacity of 65534.996 which is slightly opaque. Fully transparent pixels should be black because they have no color. The last pixel should probably be fully transparent, we'll investigate. If you think the last 3 pixels should have a green component of 61680, check with Anthony. If he agrees, we'll add another patch.

Re: Gradient and alpha produces incorrect result.

Posted: 2013-01-01T11:16:51-07:00
by glennrp
magick wrote: If you think the last 3 pixels should have a green component of 61680, check with Anthony. If he agrees, we'll add another patch.
I agree that the different underlying color of a fully-transparent pixel doesn't change the appearance (at least when the viewer respects alpha). I was just surprised that the pixels in the bottom row weren't all the same.

Re: Gradient and alpha produces incorrect result.

Posted: 2013-01-01T11:51:49-07:00
by magick
Try the latest release, you should get correct results now.

FIXED: Gradient and alpha produces incorrect result.

Posted: 2013-01-01T15:12:08-07:00
by glennrp
magick wrote:Try the latest release, you should get correct results now.
Thanks, yes, results are what I expected now.