18.11.2012 Views

PNG - Ideas to Integrated Circuits

PNG - Ideas to Integrated Circuits

PNG - Ideas to Integrated Circuits

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Intro <strong>to</strong> <strong>PNG</strong> Features<br />

Stefan Schneider's shadow-casting <strong>to</strong>ucan displayed against different backgrounds<br />

This transparency feature is far more important for the small web graphics that are typically used on web<br />

pages, such as colored (circular) bullets and fancy text. Alpha blending allows one <strong>to</strong> use anti-aliasing-creating<br />

the illusion of smooth curves on a grid of rectangular pixels by smoothly varying the pixels'<br />

colors--<strong>to</strong> make rounded and curved images that look good against any background, not just against a<br />

white background (for example). Thus the same image can be reused in many places without the<br />

"ghosting" effect that occurs with GIFs.<br />

Of course, effective replacements for GIF but<strong>to</strong>ns and icons must be comparable in size as well, and that<br />

mostly rules out truecolor RGBA images. But <strong>PNG</strong> supports alpha information with palette images as<br />

well; it's just slightly harder <strong>to</strong> implement in a smart way. A <strong>PNG</strong> alpha-palette image is just that: an<br />

image whose palette also has alpha information associated with it, not a palette image with a full alpha<br />

mask. In other words, each pixel corresponds <strong>to</strong> an entry in the palette with red, green, blue and alpha<br />

components. So if you want <strong>to</strong> have bright red pixels with four different levels of transparency, you must<br />

use four separate palette entries <strong>to</strong> accommodate them. (All four entries will have identical RGB<br />

components, but the alpha values will differ.) If you want all of your colors <strong>to</strong> have four levels of<br />

transparency, you've effectively reduced your <strong>to</strong>tal number of available colors from 256 <strong>to</strong> 64. In<br />

general, though, only some of the colors need more than one level of transparency, and recognizing<br />

which ones is where things get tricky for the programmer. (If you don't want <strong>to</strong> trust your local<br />

programmer, have a look at pngquant, which converts 32-bit RGBA <strong>PNG</strong>s in<strong>to</strong> 8-bit RGBA-palette<br />

images. If you are a programmer, also have a look at it; full source code is included.)<br />

For a better explanation with some nice sample images, see the Anti-aliasing and Transparency chapter<br />

of Chris Lilley's excellent WWW4 paper, Not Just Decoration: Quality Graphics for the Web.<br />

Gamma Correction<br />

http://libpng.org/pub/png/pngintro.html (5 of 9)10/23/06 12:44 PM

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!