PNG description

PNG at a glance

Stands for
Portable Network Graphics (or “PNG’s Not GIF”)
File extension
Tom Boutell, Tom Lane, Greg Roelofs, others (see RFC 2083)
Version 1.0, 1996; Version 1.1, 1998

Colors & bit depth

  • 1, 2, 4, 8 bit paletized;
  • 1, 2, 4, 8, 16 bit greyscale;
  • 16, 32 greyscale with alpha;
  • 24, 48 bit true color
  • 32, 64 bit true color with alpha
  • 24 bit single color transparency


  • single color 100% transparent (like GIF)
  • transparency table for paletized images with variable transparency for each palette entry
  • variable (alpha) transparency (256 levels of transparency per pixel)
Optional Goodies
Embedded Gamma information
Color profiles (ICC)
XMP metadata
Comments metadata (including compressed text and internationalization support)
Interlacing (progressive rendering)
Lossless – “deflation”
How it works
“For each image line, a filter method is chosen which predicts
the colour of each pixel based on the colours of previous pixels
and subtracts the predicted colour of the pixel from the actual
color. An image line filtered in this way is often more
compressible than the raw image line would be. On most images,
PNG can achieve greater compression than GIF, but some
implementations make poor choices of filter methods and therefore
produce unnecessarily large PNG files.” – Wikipedia

Portable Network Graphics (PNG) is a bitmapped image format that employs lossless data compression. PNG was created to improve upon and replace GIF (Graphics Interchange Format) as an image-file format not requiring a patent license. It is pronounced /ˈpɪŋ/ or spelled out as P-N-G. The PNG initialism is optionally recursive, unofficially standing for “PNG’s Not GIF”.

PNG supports palette-based, greyscale or RGB images. PNG was designed for transferring images on the Internet, not professional graphics, and so does not support other color spaces (such as CMYK).

PNG Is Good For

1. Wherever you’d use GIF
The PNG compression is usually better than GIF’s LZW.

2. Allows really tiny (e.g., 2-color) pallette

Smaller palettes mean smaller files.

3. Images with variable (alpha) transparency

You may have seen people referring to “32-bit color” when they
really mean 24-bit color (8 bits for red, 8 for green, and 8 for
blue). 32-bit images have a separate channel for transparency.
Every pixel has 8 bits of red, 8 of green, 8 of blue,
and 8 of alpha (transparency). For 64 bit RGBA images each pixel has 48 bits for describing color (3 color channels of 16 bits) and 16 bits for alpha.

MSIE for Windows doesn’t support variable transparency (though it does support
one-color transparency in both PNGs and GIFs). There is a workaround by using a filter called DXImageTransform though.

Modern web browsers like Opera,
Mozilla, and
Firefox all
support variable PNG transparency, so they let the background

Microsoft has fixed MSIE for Windows so that
variable transparency works now in version 7 and above.

Second best way to archive images

PNG is a fine choice to store compressed copies of your original images, and it wastes a lot less disk space than formats like .bmp or TIFF.

PNG Is Bad For

1. Won’t substitute for GIF animation
There’s no equivalent to GIF animation in PNG. However, look at MNGs. Still experimental at this writing, but an open standard.

2. Full color images will probably be bigger than equivalent JPEGs

Not much can be done about that. PNGs weren’t designed to be a substitute for JPEGs, and they’re not. You’re going to get better compression with lossy compression than you will with lossless compression, and that’s that. Still, if you’ve got a photography that really, truly only has a few colors, try saving it as a PNG and compare file sizes with your JPEG file. You never know.

Notes on palettes

The palette consists of maximum 256 entries. Each palette entry can have any RGB color. The pixels of the image are associated with a corresponding palette entry. This is how colors are retrieved from the paletized images.

PNG supports arbitrary sized palettes from 2 to 256, with each palette entry stored in a pLTE chunk, but common ones are 2,  16 and 256. 2 bit images (max. 4 palette entries) are uncommon, but supported).

Notes on transparency

For paletezed images you can store the transparency with two methods:

  • as transparency table (tRNS chunks)
  • as alpha channel (a separate 8 or 16 bit channel)

Using the transparency table, each palette entry can have a transparency level between 0 and 255, where 255 is fully opaque and 0 is fully transparent. In this model each palette entry (let’s say each unique color) can have a different transparency level.

If alpha transparency is used, then a separate alpha channel is stored along with the pixels. In this case each pixel can have a transparency level between 0 and 255,

This article was built on top of the one from: with necessary corrections and improvements.

Posted in Optimization Tips

Leave a Reply

Your email address will not be published. Required fields are marked *