PNG (Portable Network Graphics)

Vicente González Ruiz

July 31, 2022

Contents

 1 What is PNG?
 2 Posibilities
 3 The PNG codec
 4 Filtering (predictive encoding)
 5 “Deflate” (encoding)
 6 Entropy and lossless compression
 7 Resources

1 What is PNG?

PNG1 is an open (free of patents) raster-graphics file format, developed by the W3C, that supports lossless image compression [2]. PNG exploits the intra-channel spatial and statistical redudancy (no color transform is used).

2 Posibilities

3 The PNG codec

PNG [4?3] is based on DPCM (filtering in the PNG nomenclature) and the DEFLATE, which is a text compressor based on (Huffman coding and LZ77[1]. All these “text” compressors are completely reversible.

Figure 1: Architecture of the PNG codec. \(\mathbf I\) represents the RGB image,and \(\mathbf E\) the prediction error resulting of the predictive coding. As it can be seen, DEFLATE does not modify \(\mathbf E\), but only finds a more compact representation of the same information.

Notice that DEFLATE is applied indepently to each channel. For example, in the case of a RGBA image, four independent DEFLATE code-streams are generated.

4 Filtering (predictive encoding)

5 “Deflate” (encoding)

6 Entropy and lossless compression

To estimate the redundancy we have basically two options:

  1. Compute the 0-order (memoryless source) entropy of the signal: the higher the entropy, the lower the redudancy. In fact, if we suppose that the samples of the signal are uncorrelated, the 0-order entropy is an exact measure of the expected bit-rate achieved by an arithmetic encoder (the most efficient entropy compressor). Unfortunately, the 0-order entropy is usually only a estimation of the redundancy, i.e., lower bit-rates can be achieved in practice after using a high-order decorrelation.
  2. A better way is to use an lossless compressor: the higher the length of the compressed file compared to the length of the original file, the lower the redundancy.3 Notice, however, that although this estimation is more accurate than the 0-order entropy, in general, it depends on the compressor (different algoritms can provide different estimations).

7 Resources

[1]   Nelson M. and Gailly J. The Data Compression Book. M&T Books, 1996.

[2]   Greg Roelofs and Richard Koman. PNG: the definitive guide. O’Reilly & Associates, Inc., 1999.

[3]   David Salomon. Data Compression: The Complete Reference. Springer Science & Business Media, 2004.

[4]   Khalid Sayood. Lossless Compression Handbook. Elsevier, 2002.

1Notice that only the first part of the video describes PNG. The second part refers to QOI that is a different image compression scheme.

2Authors of The Data Compression Book [1]

3If the length of the compressed file is equal or larger than the length of the original file, then, for the compressor that we are using, there is not redundancy in the original representation.