The Past and Present of the PNG Format
PNG (Portable Network Graphics) is a lossless compressed bitmap image format designed to replace GIF and TIFF while offering features that GIF lacked. The motivation behind PNG's creation stemmed from Unisys' enforcement of its LZW (Lempel-Ziv-Welch) compression algorithm patent, which restricted the use of GIF in free software.
PNG comes in three primary variants: 8-bit, 24-bit, and 32-bit.
8-bit PNG supports two types of transparency: indexed and alpha transparency.
24-bit PNG does not support transparency.
32-bit PNG builds upon 24-bit by adding an 8-bit alpha channel, enabling 256 levels of transparency.
The numbers in PNG8 and PNG24 indicate the maximum number of colors they can store:
8 represents 2⁸ (256 colors).
24 represents 2²⁴ (approximately 16.7 million colors).
PNG32 extends 24-bit color with an 8-bit transparency channel, allowing for smooth transparency effects.
Advantages of PNG
PNG has two key strengths: lossless compression and transparency support.
Due to its use of a derivative of the LZ77 algorithm, PNG achieves high compression ratios without data loss. It efficiently encodes recurring patterns, preserving image quality even after multiple saves.
PNG supports 256 levels of transparency, enabling smooth blending of image edges with any background—eliminating jagged aliasing. This feature is absent in GIF and JPEG.
History of PNG
In early 1995, Unisys began enforcing licensing fees for the LZW algorithm used in GIFs. To avoid patent issues, PNG (for single images) and MNG (Multiple-image Network Graphics, for animations) were developed as alternatives.
On April 20, 2007, Mozilla proposed APNG (Animated PNG) as an official standard, but the PNG Group rejected it in an 8:10 vote, preferring to promote MNG instead. Despite this, Mozilla continued supporting APNG.
PNG vs. JPEG 2000 vs. GIF
In the early days of the web, GIF (1987) was nearly the only choice for images, followed by JPEG (1992), PNG (1996), APNG (2004), and WebP (2010).
PNG can be seen as a patent-free, enhanced version of GIF. Some predicted that PNG would fade after June 20, 2003—when GIF's patents expired—due to Internet Explorer's poor PNG support (especially IE6 and IE7, which dominated 90% of the market). However, as IE's influence waned, PNG's adoption grew.
JPEG 2000, an upgrade to JPEG, introduced both lossy and lossless compression but failed to surpass PNG in transparency support. Early browsers lacked PNG compatibility, making JPEG and GIF the dominant formats. While GIF had limited color depth, JPEG introduced blurring due to lossy compression. PNG, on the other hand, offered precise color reproduction with efficient file sizes, making it ideal for gradients.
Limitations
Unlike TIFF, JPEG 2000, and DNG, PNG does not natively support embedded EXIF (Exchangeable Image File Format) metadata, commonly used in digital photography.