PNG

From Just Solve the File Format Problem
(Difference between revisions)
Jump to: navigation, search
m
(Extensions by chunk type)
 
(27 intermediate revisions by 10 users not shown)
Line 6: Line 6:
 
|locfdd={{LoCFDD|fdd000153}}
 
|locfdd={{LoCFDD|fdd000153}}
 
|pronom={{PRONOM|fmt/13}}, {{PRONOM|fmt/12}}, {{PRONOM|fmt/11}}
 
|pronom={{PRONOM|fmt/13}}, {{PRONOM|fmt/12}}, {{PRONOM|fmt/11}}
 +
|kaitai struct=png
 +
|wikidata={{wikidata|Q178051}}
 
|released=1996
 
|released=1996
 
}}
 
}}
 
'''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]].
 
'''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 some are doing so now. Since the [[LZW]] patent that affected GIF is expired now, the "free format" motivation for the switch no longer applies.
+
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.
 
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 ==
+
== 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 [[FourCC|chunk type code]]. Each chunk also has a 4-byte trailer containing a checksum.
  
A PNG file consists of an 8-byte signature (hex <code>89 50 4E 47 0D 0A 1A 0A</code>), followed by a sequence of "chunks". Each chunk has an 8-byte header, 4 bytes of which indicate the chunk length, and 4 bytes of which are a [[FourCC|chunk type code]] indicating the type of data stored in the chunk. Each chunk also has a 4-byte trailer which stores a checksum.
+
== Identification ==
 +
A file begins with an 8-byte signature: {{magic|89 50 4E 47 0D 0A 1A 0A}}.
 +
 
 +
A standard PNG file also has ASCII "{{magic|IHDR}}" at offset 12. You can check for this to distinguish it from [[CgBI]].
  
 
== Extensions ==
 
== Extensions ==
 +
=== Extensions by chunk type ===
 
{| class="wikitable"
 
{| class="wikitable"
 
! Chunk type
 
! Chunk type
! References
+
! References and remarks
 
|-
 
|-
|oFFs, pCAL, sCAL, gIFg, gIFx, gIFt, fRAc || Refer to [http://pmt.sourceforge.net/specs/pngext-1.2.0-pdg-h20.html Extensions to the PNG 1.2 Specification, v1.2.0].
+
|<code>oFFs</code>, <code>pCAL</code>, <code>sCAL</code>, <code>gIFg</code>, <code>gIFx</code>, <code>gIFt</code>, <code>fRAc</code> || Refer to [http://pmt.sourceforge.net/specs/pngext-1.2.0-pdg-h20.html Extensions to the PNG 1.2 Specification, v1.2.0].
 
|-
 
|-
|sTER || Refer to [ftp://ftp.simplesystems.org/pub/libpng/png/documents/pngext-1.3.0-pdg.html Extensions to the PNG 1.2 Specification, v1.3.0].
+
|<code>sTER</code> || Refer to [ftp://ftp.simplesystems.org/pub/libpng/png/documents/pngext-1.3.0-pdg.html Extensions to the PNG 1.2 Specification, v1.3.0].
 
|-
 
|-
|dSIG || Refer to [ftp://ftp.simplesystems.org/pub/libpng/png/documents/pngext-1.4.0-pdg.html Extensions to the PNG 1.2 Specification, v1.4.0], and the [http://png-dsig.sourceforge.net/ PNG dSIG website].
+
|<code>dSIG</code> || Refer to [ftp://ftp.simplesystems.org/pub/libpng/png/documents/pngext-1.4.0-pdg.html Extensions to the PNG 1.2 Specification, v1.4.0], and the [http://png-dsig.sourceforge.net/ PNG dSIG website].
 
|-
 
|-
|acTL, fcTL, fdAT || Used in [[APNG]] files.
+
|<code>acTL</code>, <code>fcTL</code>, <code>fdAT</code> || Used in [[APNG]] files.
 
|-
 
|-
|vpAg || Used by [[ImageMagick]].
+
|<code>vpAg</code>, <code>caNv</code>, <code>orNT</code> || Used by [[ImageMagick]].
 
|-
 
|-
|CgBI || Refer to [[CgBI]].
+
|<code>CgBI</code> || Refer to [[CgBI]].
 +
|-
 +
|<code>eXIf</code>, <code>exIf</code> || [[Exif]] metadata. Refer to [http://ftp-osl.osuosl.org/pub/libpng/documents/proposals/eXIf/png-proposed-eXIf-chunk-2017-06-15.html PNG Proposed eXIf chunk] [approved 2017-07].
 +
|-
 +
|<code>iDOT</code> || Used by Apple products. Some info at [https://www.hackerfactor.com/blog/index.php?/archives/895-Connecting-the-iDOTs.html].
 +
|-
 +
|<code>cpIp</code>, <code>cmOD</code> || Used in [[PNG Plus]].
 +
|-
 +
|<code>prVW</code>, <code>mkBF</code>, <code>mkBS</code>, <code>mkBT</code>, <code>mkTS</code> || Used in [[Fireworks PNG]].
 
|}
 
|}
 +
 +
=== Other extensions ===
 +
* [[XMP]] metadata can be stored in an <code>iTXt</code> chunk with keyword "XML:com.adobe.xmp". Refer to the [[XMP#Specifications|XMP Specification]], Part 3.
  
 
== Related Formats ==
 
== Related Formats ==
  
* [[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.
 
* [[MNG]]
 
 
* [[APNG]]
 
* [[APNG]]
 +
* [[MNG]]
 +
* [[JNG]]
 
* [[CgBI]]
 
* [[CgBI]]
 
* [[Portable Bitmap Format]]
 
* [[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 ==
 
== Specifications ==
Line 54: Line 73:
 
== Metaformat files ==
 
== Metaformat files ==
  
* [https://www.synalysis.net/Grammars/png.grammar Synalysis grammar file] (for Hexinator / Synalize It!; [[Synalysis grammar file|more details]])
+
* [http://formats.kaitai.io/png/index.html Kaitai Struct Spec]
 +
* {{Synalysis|png}}
  
 
== Software ==
 
== Software ==
 +
''Support for PNG is ubiquitous. Software listed here may have been selected arbitrarily.''
 
* [http://www.libpng.org/pub/png/libpng.html libpng] and [http://www.zlib.net/ zlib]
 
* [http://www.libpng.org/pub/png/libpng.html libpng] and [http://www.zlib.net/ zlib]
 +
* [http://www.libpng.org/pub/png/apps/pngcheck.html pngcheck: official PNG tester and debugger]
 +
* [http://entropymine.com/jason/tweakpng/ TweakPNG: low-level utility for examining and modifying PNG image files]
 +
* [http://lodev.org/lodepng/ LodePNG]
 +
* [https://libspng.org/ libspng]
 
* [http://coptr.digipres.org/Bad_Peggy Bad Peggy: scans images for problems]
 
* [http://coptr.digipres.org/Bad_Peggy Bad Peggy: scans images for problems]
 +
* [https://www.madebymikal.com/pngtools-0-4/ PNGtools: low-level manipulation of PNG structure]
 +
* [https://encode.su/threads/1725-pngthermal-pseudo-thermal-view-of-PNG-compression-efficiency PNGThermal: indicates compression cost per pixel]
 +
* [[Konvertor]]
  
 
== Sample files ==
 
== Sample files ==
 
* [http://www.libpng.org/pub/png/png-sitemap.html#images PNG Images]
 
* [http://www.libpng.org/pub/png/png-sitemap.html#images PNG Images]
 +
* [http://pngimg.com/ pngimg.com]
 +
* {{DexvertSamples|image/png}}
  
 
== Links ==
 
== Links ==
Line 67: Line 97:
 
* [[Wikipedia:Portable Network Graphics|Portable Network Graphics (Wikipedia)]]
 
* [[Wikipedia:Portable Network Graphics|Portable Network Graphics (Wikipedia)]]
 
* {{EGFF|png|PNG File Format Summary}}, from the [[Encyclopedia of Graphics File Formats]]
 
* {{EGFF|png|PNG File Format Summary}}, from the [[Encyclopedia of Graphics File Formats]]
* [http://www.forensicswiki.org/wiki/Portable_Network_Graphics_%28PNG%29 Forensics Wiki article]
+
* [{{ForensicsWikiURL|portable_network_graphics_%28png%29}} Forensics Wiki article]
 
* [http://imgur.com/a/MtQZv#7 PNG format mini-poster]
 
* [http://imgur.com/a/MtQZv#7 PNG format mini-poster]
* [https://mattscodecave.com/posts/plaidctf-2015---corrupt-png How to repair a PNG that has suffered DOS->Unix character conversion]
+
* [https://mattscodecave.com/posts/plaidctf-2015---corrupt-png.html How to repair a PNG that has suffered DOS->Unix character conversion]
 
* [http://blog.codinghorror.com/getting-the-most-out-of-png/ Getting the Most Out of PNG (Jeff Atwood)]
 
* [http://blog.codinghorror.com/getting-the-most-out-of-png/ Getting the Most Out of PNG (Jeff Atwood)]
 +
* [https://medium.com/@duhroach/how-png-works-f1174e3cc7b7#.n3l0wota6 How PNG Works]
 +
* [https://www.da.vidbuchanan.co.uk/blog/hello-png.html Hello, PNG!]

Latest revision as of 23:32, 29 January 2024

File Format
Name PNG
Ontology
Extension(s) .png
MIME Type(s) image/png
LoCFDD fdd000153
PRONOM fmt/13, fmt/12, fmt/11
Wikidata ID Q178051
Kaitai Struct Spec png.ksy
Released 1996

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.

Contents

[edit] 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.

[edit] Identification

A file begins with an 8-byte signature: 89 50 4E 47 0D 0A 1A 0A.

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

[edit] Extensions

[edit] Extensions by chunk type

Chunk type References and remarks
oFFs, pCAL, sCAL, gIFg, gIFx, gIFt, fRAc Refer to Extensions to the PNG 1.2 Specification, v1.2.0.
sTER Refer to Extensions to the PNG 1.2 Specification, v1.3.0.
dSIG Refer to Extensions to the PNG 1.2 Specification, v1.4.0, and the PNG dSIG website.
acTL, fcTL, fdAT Used in APNG files.
vpAg, caNv, orNT Used by ImageMagick.
CgBI Refer to CgBI.
eXIf, exIf Exif metadata. Refer to PNG Proposed eXIf chunk [approved 2017-07].
iDOT Used by Apple products. Some info at [1].
cpIp, cmOD Used in PNG Plus.
prVW, mkBF, mkBS, mkBT, mkTS Used in Fireworks PNG.

[edit] Other extensions

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

[edit] Related Formats

[edit] Specifications

[edit] Metaformat files

[edit] Software

Support for PNG is ubiquitous. Software listed here may have been selected arbitrarily.

[edit] Sample files

[edit] Links

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox