FIXED: Gradient and alpha produces incorrect result.

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
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

FIXED: Gradient and alpha produces incorrect result.

Post by glennrp » 2012-12-29T19:18:39-07:00

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.
Last edited by glennrp on 2013-01-01T15:13:15-07:00, edited 1 time in total.

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

Re: Gradient and alpha produces incorrect result.

Post by magick » 2012-12-29T21:25:49-07:00

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.

User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Gradient and alpha produces incorrect result.

Post by glennrp » 2013-01-01T11:16:51-07:00

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.

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

Re: Gradient and alpha produces incorrect result.

Post by magick » 2013-01-01T11:51:49-07:00

Try the latest release, you should get correct results now.

User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

FIXED: Gradient and alpha produces incorrect result.

Post by glennrp » 2013-01-01T15:12:08-07:00

magick wrote:Try the latest release, you should get correct results now.
Thanks, yes, results are what I expected now.

Post Reply