PNG has been created as a lossless image format, meaning it's supposed to exactly preserve all details of an image, even minuscule ones that are hardly noticeable. Preservation of those tiny details costs a lot in terms of file size.

On the other hand, lossy formats (like JPEG) produce much smaller files, because they don't save unneccessary details.

The good news is that PNG can be used as a lossy format and produce files few times smaller, while remaining perfectly compatible with lossless PNG decoders.

Lossy averaging filter

PNG has an ability to “guess” pixels based on their top and left neighbors and successful guesses compress to almost nothing.

Usually only few pixels match a guess, but latest ImageAlpha's “Blurizer” option manipulates image data to match the guesses, making compression much more effective.

Images below are heavily compressed for demonstration how the loss looks like.

goose bumps
Diagonally blurred. 77KB instead of 550KB.

This method is based on work by Michael Vinther and William MacKay.

PNG8

PNG usually needs 4 bytes per pixel for R, G, B and alpha components. PNG8 removes 3/4 of the data from the file by storing indexes of a color palette instead. ImageAlpha uses pngquant2, which has a very advanced palette selection algorithm and preserves alpha transparency.

dithering
64-color image. 111KB instead of 714KB.

Posterization

Posterization reduces the number of unique color intensities in a file, but in a smarter way than a “posterize” filter in graphics programs. This reduction makes noise in images easier to compress.


Median-Cut posterized. 100KB instead of 374KB.

Lossy PNG vs GIF and JPEG

GIF is a complete waste of bandwidth. In all typical cases it's larger than optimized PNG.

Whether lossy PNG gives better results than JPEG depends on the image. JPEG often gives smaller files, except when image has sharp edges (e.g. text) or any transparency (which JPEG does not support at all).

Optimized lossy PNG is still a bit larger than lossy JPEG-XR/WebP/JPEG-2K, but unlike these formats it's supported by all browsers and operating systems without any fuss or hacks.

Try yourself

With ImageAlpha you can choose the best lossy method for each file and usually halve the size of PNG files with little quality loss.

Download the latest version for OS X (or portable posterizer/blurizer and pngquant2 separately). It's all Open Source.

Please donate to support my image compression tools and research.