PNG Compression

The most notable aspect of PNG compression is that it is “lossless,” meaning no information is lost in the compression process. A decompressed PNG image is identical to the original.

PNGs use a “deflate” compression scheme (the same engine used to “zip” files with gzip, WinZip, and similar programs). Like GIFs, PNG’s compression works on rows of pixels, taking advantage of repetition in bytes of information. By use of internal filters , it can take advantage of some vertical patterns as well. PNG’s compression engine typically compresses images 5 to 25% better than GIF (and up to 39% better under optimal conditions). Not all tools implement PNG compression to its full potential. See "Creating PNG Files" later in this chapter.

Get Web Design in a Nutshell, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.