[AlphaMix] PNG alpha-channel viewer



[download AlphaMix]

Why ...

One of the features of PNG is its capability to store images consisting of RGB color data together with a so called alpha-channel. The alpha-channel specifies for each pixel the amount of transparency, or when you like it the other way round the amount of opacity.

Compared to this, the transparency capability of GIF is only an on/off method. A pixel is transparent or not. With PNG you have the availability of as many levels of transparency as there are levels of color, which means in most cases 256 levels.

The use of alpha-channels is three-fold. First of all, you can do all kinds of fading or shadowing. Just like in real life, many materials ranging from glass to smoke are visible, but also allow you to see what is behind it. Second use of alpha channels is the possibility to create images that are not rectangular. The image itself is of course still a rectangle, but with the alpha-channel you create a mask that you can give any shape you like.

Third use is what is called anti-aliasing or sub-pixeling. This addresses the problem of the wrongly colored outlines around fonts, that we see so often on the web. Instead of using half-tones for pixels on the edge, the pixel should be full color, with an alpha value representing the level of anti-aliasing. This way, images could be displayed against backgrounds of any color or pattern.

[AlphaMix windows]

playing around with the menu-options allows various displays

What ...

The latest versions of Netscape, IExplorer and Opera are supporting PNG images. However, all of them don't handle transparency, alpha and background colors correctly. Therefore I wrote this small Windows-95/NT program that demonstrates how proper support of alpha-channels should be done. AlphaMix allows you to display PNG images, probably with an alpha-channel or a transparency chunk, against either a background image or against the color specified using a background chunk.

Similar to web-browsers, by default the background image will be "tiled" to fill the whole window. Using the menu this option can be changed to "centered". When no background image is loaded, when present, the color of the background chunk will be used. Also this option can be disabled.

To get going, after downloading AlphaMix and extracting the zip-file, start the program and open test_img.png as foreground image (ctrl-O). You will see the PNG 3-D logo against the color in the background chunk. Look how no artifacts of anti-aliasing are visible. Now open test_bkg.png as the background image (ctrl-B). The background color disappears and is replaced by a tiled checkboard pattern. Playing around with the menu options will enable you to get all the different views shown above.

Finally you are able to save the combination of the (tiled) background and the (semi-) transparent foreground image into a PNG-file. This output file itself will not have any alpha-channel or transparency.

[AlphaMix demo edge]
 
[AlphaMix demo ball]
two images using a tiled
B&W background and
an RGBA foreground image
 

PS

And last but not least, nothing prevents you to use AlphaMix as a straight forward PNG image viewer for the MS Windows platform. In Windows Explorer you can set AlphaMix as the default application for PNG files with View | Options | File Types. After that, double-clicking on any PNG-file will start AlphaMix and show the image.


[back to PNG] [Anti-aliasing and Amaya] [Adam7 interlacing demo] [PngSuite] [PingPong]


  Willem van Schaik, Holland, September 1999     http://www.schaik.com/wwwillem.html