unclear about alpha reporting in verbose info IM 6.4.3-8

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
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

unclear about alpha reporting in verbose info IM 6.4.3-8

Post 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?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

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

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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
Post Reply