PNG
By PNG Development Group / W3C
PNG (Portable Network Graphics) is a raster image file format that uses lossless compression, meaning an image can be saved and reopened without any loss of pixel detail, and it natively supports full alpha-channel transparency. It was…
Definition
PNG (Portable Network Graphics) is a raster image file format that uses lossless compression, meaning an image can be saved and reopened without any loss of pixel detail, and it natively supports full alpha-channel transparency. It was created as a free, patent-unencumbered replacement for GIF after a licensing dispute over GIF's compression algorithm in the mid-1990s, and it has since become one of the most widely used image formats on the web and in software for icons, screenshots, and graphics requiring transparency.
Overview
PNG was developed in response to a licensing controversy: GIF, the dominant lossless web image format at the time, used LZW compression, which was covered by a patent that Unisys began enforcing against software vendors in 1994, creating uncertainty for anyone shipping GIF-encoding software. A group of developers created PNG as an openly specified, royalty-free alternative that improved on GIF technically as well, adding true alpha transparency (GIF only supports binary on/off transparency) and support for far more colors than GIF's 256-color palette limit, while using a different, unencumbered compression method. Mechanically, PNG compresses image data using DEFLATE, the same lossless compression algorithm used by zip and gzip, applied after a preprocessing step called filtering that transforms each row of pixels based on neighboring pixel values to make the data more compressible before DEFLATE runs on it. Because DEFLATE is lossless, decompressing a PNG reconstructs the exact original pixel data with no degradation, unlike JPEG's lossy compression which discards information to achieve smaller file sizes. PNG supports several color modes, including full 24-bit truecolor with an optional 8-bit alpha channel for transparency, 8-bit palette-based indexed color similar to GIF, and grayscale, giving it flexibility across different image types. Among image formats, PNG occupies the lossless, general-purpose slot: it's typically the right choice for screenshots, diagrams, logos, icons, and any image with sharp edges, text, or transparency, where JPEG's lossy compression would introduce visible artifacts around hard edges. JPEG remains the better choice for photographic images where some quality loss is acceptable in exchange for much smaller file sizes, since PNG's lossless compression produces far larger files for photo-like content with lots of color gradation and noise. WebP and AVIF are newer formats that can match or beat PNG's lossless compression ratios and also offer lossy modes, and have been gaining ground as browser support has matured, though PNG remains near-universally supported across all software and hardware. In practice, PNG is the default format for website UI elements, logos, and any image needing transparency, for screenshots taken by nearly every operating system, and for any raster asset produced by design tools that must not lose quality through repeated edits and re-saves the way JPEG would. It is also embedded as an interchange format inside many document, presentation, and file formats. The main trade-off is file size on photographic content: because PNG cannot discard information the way JPEG does, a photo saved as PNG is typically several times larger than the same photo saved as a reasonably compressed JPEG, with no visible quality benefit for a source that is already a lossy photograph. For that reason, most web and application workflows still choose JPEG or newer lossy formats for photographs and reserve PNG for graphics, transparency, and lossless-fidelity needs.
Specification
- Lossless compression preserving exact original pixel data
- Full alpha-channel transparency support, unlike GIF's binary transparency
- Uses DEFLATE compression with row-based filtering preprocessing
- Supports truecolor, indexed-palette, and grayscale color modes
- Patent-free, openly specified format free to implement
- Near-universal support across browsers, operating systems, and software
- Repeated saves do not degrade image quality