Technical articles on the PNG file format and
the related compression technologies
This site contains a collection of comments, impressions, comparisons,
experiments and ideas regarding the
(Portable Network Graphics)
file format, and the related technologies:
(Data Compression Format and Library),
Graphics). It is focused on the compression algorithms used in PNG.
PNG uses ZLIB streams [RFC1950
as compressed datastreams. The compression algorithm, called Deflate
], was designed by
Phil Katz and used initially in PKZIP
Jean-loup Gailly and Mark Adler rewrote the code, avoiding any patented
algorithms. This code, freely available in source, can be found
Additional technical details are provided
A good explanation of the Deflate
algorithm by Antaeus Feldspar
We use the term ZLIB
(written with capital letters) when we refer to the
standard or to standard-compliant streams, and the term zlib
with small letters) when we refer to the reference implementation.
Proposal for correcting the ZLIB
In the current ZLIB specification, described in RFC1950, some boundary
conditions regarding the size of the sliding window are incomplete.
The proposal addresses this issue.
Proposal for a new zlib strategy: Z_RLE
Z_RLE is a fast strategy that has a high speed and a low memory overhead,
like Z_HUFFMAN_ONLY, but achieves a better compression ratio.
The Z_RLE strategy is implemented in the zlib-1.2.x series.
TOO_FAR in zlib is not too far...
A parameter used in the zlib source code should be set to a higher value,
in order to achieve a slightly better compression.
A guide to PNG optimization
PNG compression does not depend only on the image statistics, but it may vary
within large limits, depending on several compression parameters.
Brute-force vs. heuristic filtering
The filtering heuristics proposed in the PNG specification yield good results
in most of the cases. There are a few cases, however, when these heuristics are
less than optimal.
LZW-GIF can be sometimes better than Deflate
The Deflate compression used by PNG is superior to the LZW compression used by
GIF. There are very few isolated cases when LZW is marginally better, and this
article presents such examples.
8 bits per pixel in paletted images
This article shows an example in which the encoding of an image using as few
bits per pixel as possible, is suboptimal.
Although many books (mostly about computer imaging) mention PNG and MNG, only a
few explain how these formats actually work. If you are looking for such
details, you may find this list useful.
Uncompressed or PNG-compressed images that can be freely distributed, and can
be used in compression tests.
Copyright © 2000-2011 Cosmin Truţa.
Appeared: 16 Jan 2000. Last updated: 31 Mar 2011.