Dear Lists,

I tried to draw a white block with alpha-channel gradient on top of black.
The result appears to be non-linear, and I think it is problematic.

image = ones((255, 255, 4), dtype='u1')
image[:, :, 0:3] = 255
image[:, :, 3] = arange(0, 255)[:, newaxis]
gca().set_axis_bgcolor('k')
imshow(image)

The color of the pixel with alpha = 128 is about (30, 30, 30).
We can confirm this with
cla()
image[:, :, 3] = 128
imshow(image)

On Inkscape, a white block with alpha = 128 on top of a black box gives a
final color of r,g,b=128, 128, 128.

I did a rough fit and apparently matplotlib is calculating the final pixel
brightness with (notice the original pixel is 0)

r = cr * (alpha / 255.) ** 3 , (same for g and b)

shouldn't it be r = cr * alpha / 255?

This affects matplotlib-1.0.1 and a not so recent copy of the git
master(ba4043a35d4c2).


Regards,

Yu
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to