PNG

Portable Network Graphics (PNG) was devised starting in a discussion on newsgroup comp.graphics in 1995, with the first version of its specification released in 1996. The motivation for its creation was to create a free and unencumbered image format in the wake of the patent issue with GIF.

PNG has become a very popular graphic format, but widespread adoption on the Web was slow due to the fact that the first specification came out over a year after the Web had begun to be popular with the general public, meaning that there were many sites and browsers out there not using and supporting the new format; subsequently, browsers began to support it, but often had rendering problems which persisted even in fairly late versions years later; this caused webmasters to be slow to switch from GIF to PNG, though many eventually did so. Since the LZW patent that affected GIF is expired now, the "free format" motivation for the switch no longer applies.

Unlike GIF, PNG officially supports only still graphics, not animation. However APNG, an unofficial extension of the PNG image format that retains the .png file extention does support animation. Another related format, MNG, officially does support animation.

Format details
A PNG file consists of an 8-byte signature, followed by a sequence of chunks. Each chunk has an 8-byte header containing a 4-byte chunk length, and a 4-byte chunk type code. Each chunk also has a 4-byte trailer containing a checksum.

Identification
A file begins with an 8-byte signature:.

A standard PNG file also has ASCII "" at offset 12. You can check for this to distinguish it from CgBI.

Other extensions

 * XMP metadata can be stored in an  chunk with keyword "XML:com.adobe.xmp". Refer to the XMP Specification, Part 3.

Related Formats

 * APNG
 * MNG
 * JNG
 * CgBI
 * Portable Bitmap Format
 * zlib-style DEFLATE compression: Used to compress image and other data.
 * CRC-32: Used to calculate a checksum of each chunk.
 * ICC profile: The format used by iCCP chunks.

Specifications

 * W3C PNG specification (latest version)
 * Specific versions: 1996-10-01 · 2003-05-20 · 2003-11-10
 * RFC 2083: PNG Specification Version 1.0
 * ISO/IEC 15948:2004 (not free to download)

Metaformat files

 * Kaitai Struct Spec

Software
''Support for PNG is ubiquitous. Software listed here may have been selected arbitrarily.''
 * libpng and zlib
 * LodePNG
 * libspng
 * Bad Peggy: scans images for problems
 * PNGtools: low-level manipulation of PNG structure
 * PNGThermal: indicates compression cost per pixel
 * Konvertor

Sample files

 * PNG Images
 * pngimg.com
 * https://telparia.com/fileFormatSamples/image/png/

Links

 * PNG website
 * Portable Network Graphics (Wikipedia)
 * , from the Encyclopedia of Graphics File Formats
 * Forensics Wiki article
 * PNG format mini-poster
 * How to repair a PNG that has suffered DOS->Unix character conversion
 * Getting the Most Out of PNG (Jeff Atwood)
 * How PNG Works
 * Hello, PNG!