Page 1 of 1

unclear about alpha reporting in verbose info IM 6.4.3-8

Posted: 2008-09-23T15:19:06-07:00
by fmw42
When I do:

convert grad.png -alpha copy grad_acopy.png
convert grad_acopy.png -verbose info:

The result is:
alpha:
min: 0 (0)
max: 65535 (1)
mean: 32767.5 (0.5)
standard deviation: 19108.4 (0.291576)
Alpha: none #0000000000000000

What is the significance of the last line above, when the alpha channel is a gradient?

Re: unclear about alpha reporting in verbose info IM 6.4.3-8

Posted: 2008-09-23T16:24:33-07:00
by anthony
That line defines the images 'Transparent color' which is only used in PNG8 type PNG images that is a PNG with a pallette. In the case of a normal PNG it does not need or use this color, so really its value us undefined and not important.

It defines the color to assign for the pallette index that is to represent full-transparency. It is easier to explain in GIF.
http://www.imagemagick.org/Usage/formats/#gif_trans

Basically GIF (and PNG8) has a pallette of 256 colors. The pixel data itself consists of a 8bit index into this pallette. On color in that pallette is flagged as representing 'transparency', however that pallette index still has a color. This is that color, even though when transparency is enabled that color does not normally get used.

See the link above for GIF which has examples of all this.

In summery. It is the color to assign to the 'transparent' color index of pallette images. For normal image usage it is un-important. For creating images that will be used on old browsers and image viewers that does not have transparency, then it can be very important.

PS: Also look at the old bug file...
http://www.imagemagick.org/Usage/bugs/blur_trans/
and the section "Transparency has Color" which is related to this.

Re: unclear about alpha reporting in verbose info IM 6.4.3-8

Posted: 2008-09-23T17:39:11-07:00
by fmw42
Thanks, I do recall the issue of GIF with transparency assigned at some color value in the 256 colors. I just never knew to what that line in the verbose info related. Thanks for the explanation