PNG (Portable Network Graphics) image file format
- Typical file name extension
.png
- Magic bytes
0x89 0x50 0x4e 0x47 0x0d 0x0a 0x1a 0x0a at file offset 0x00.
- MIME type
image/png
- Popularity
- Medium.
- History
- Was developed as a replacement for the patent-encumbered GIF
format in 1995.
- File structure
- A PNG stream consists of a number of data chunks.
Each chunk stores its type and size, then follows the chunk data, then a CRC-32 checksum value.
This helps identifying corrupted files.
- The chunk type contains information on whether a particular chunk can, must be or should be
copied when a PNG file is modified.
- Compression types
- Deflate (RFC 1951) is
the only supported compression type.
- Before the image data is compressed with Deflate, it can optionally be
pre-processed to
transform it to a sequence of bytes that compresses better.
This step is lossless.
- Image types
- Grayscale, with 1, 2, 4, 8 or 16 bits per sample.
- RGB truecolor, with 24 or 48 bits per pixel.
- Paletted, with 1, 2, 4 or 8 bits per pixel.
- Both grayscale and truecolor can store an alpha channel which contains
transparency information.
- Metadata
- A
tEXt chunk can store textual comments.
These are pairs of keywords and values, e.g. (Author, John Doe).
The specs suggest
a number of standard keywords like Title, Author
or Copyright.
- Glenn Randers-Pehrson has created a list
with suggestions of how JPEG/EXIF and TIFF metadata should be converted to PNG.
- Libraries
- libpng -
free C library to read and write PNG files.
- List of Java libraries -
includes PNG libraries,
note that since Java 1.3 reading PNG is built into the runtime
library, since 1.4 it can also write PNG files.
- Software
- Almost every web browser and image viewer can read GIF. Most major image editing software can
read and write PNG files.
- Image conversion software with PNG support.
- Image editors with PNG support.
- Image viewers with PNG support.
- Specification
- PNG specification on the PNG website
- The book PNG: The Definitive Guide by Greg Roelofs,
ISBN 1-56592-542-4, published by O'Reilly & Associates.
As of July 2003, you can read the complete PNG book online.
An offline copy is available from SourceForge (~ 8 MB).
- Sites
- PNG Home Site
- PNG section of DataCompression.info
- Google directory PNG section
- W3C page on PNG