Portable Network Graphics

8950.4e47.0d0a.1a0a hex \ x89PNG \ r \ n \ x1a \ n ( ASCII C notation )

Portable Network Graphics (PNG [ pɪŋ ], Engl. Portable Network Graphics ) is a graphics format for raster graphics with lossless compression. It was designed as a free replacement for the older, up to 2006 with patent claims loaded GIF format and is less complex than TIFF. PNG beside different color depths supported by transparency alpha channel. PNG is the most widely used lossless graphics format on the internet.

  • 3.1 header
  • 3.2 compression 3.2.1 prefilter

History

The development of the PNG format began in late 1994, as compared to other graphics formats such as TIFF, GIF and JFIF so pretty late. This was triggered by the software license claims Unisys for the LZW algorithm used by GIF.

Already on 4 January 1995 Thomas Boutell was able to present an early draft ( PBF Draft 1 ). The first proper PNG specification (version 1.0) by Thomas Boutell and Tom Lane was on 1 October 1996 official W3C Recommendation. On 14 October 1996 PNG received by the IANA MIME type image / png assigned. On January 15, 1997 PNG was approved by the IETF as RFC 2083. On 31 December 1998, revised by Adam Costello and Glenn Randers - Pehrson PNG specification version 1.1 was released. On August 11, 1999 Glenn Randers - Pehrson finally released the final version 1.2 so far. This was collected on 10 November 2003 on the ISO standard ISO / IEC 15948:2003 and simultaneously to W3C Recommendation PNG (Second Edition).

Properties

The PNG format has no patent restrictions, as was the case until 2004, by using the LZW algorithm in GIF. Each software manufacturer is therefore publish programs that read and write PNG without payment of royalties. This is particularly important for providers of free programs an advantage. It is a universal, from the World Wide Web Consortium (W3C ) recognized format and is supported by all modern web browsers.

PNG was designed unlike GIF, aware without animation ability, as this has its own format ( MNG ) was developed. The two formats should replace the GIF down completely; to this, it was not until today. MNG is neither W3C recommendation nor an ISO standard and is not supported by most Web browsers. With APNG an alternative, also limited common animation format was created independently of the PNG and MNG - development teams based on PNG.

Color depths

PNG can handle as GIF pixels from a color palette with up to 256 entries ( 8 bit). In addition, the storage of gray-scale images with 1, 2, 4, 8 or 16 bits, and color images (RGB) with 8 or 16 bits per channel, i.e., 24 or 48 bits per pixel are possible. The compression rate of PNG is usually better than GIF.

Transparency

PNG files can contain transparency information, either in the form of an alpha channel or for each color of the color palette. An alpha channel is additional information indicating, for each pixel, how much to show through the background of the image. PNG supports alpha channels of 8 bits or 16 bits, corresponding to 256 or 65,536 degrees of transparency strength. GIF is only possible to declare a single palette entries as completely transparent. The PNG format allows Thus, regardless of the background to smooth the edges of text and images. You can use real shadows that hide in the background, or create images that are shaped as desired - if the display program dominates the PNG format.

Internet Explorer has up to version 6 Problems with the display of PNG files with alpha channel. PNG files with binary ("yes / no" - ) transparency, however, error-free. There are also workarounds to use the alpha channel in older versions of Internet Explorer. The latest versions of the browser Mozilla Firefox, Konqueror, Safari and Opera as well as the Microsoft Internet Explorer version 7 support PNG largely error-free.

Metadata and data blocks ( chunks )

PNG support metadata and optional data blocks ( " chunks "), which may contain more information about the image, such as color correction. These data blocks are characterized by four letters ( for example, text for textual information ) and can be edited with programs like TweakPNG. Applications can also define private data blocks for their own purposes. Adobe Fireworks PNG used as an application format and uses private data blocks to store in various other information. However, it is also a likelihood of confusion with the much smaller, normal PNG files.

However, supports up to Safari and Firefox (after activation) so far no browser embedded color profiles ( ICCP chunks ). You therefore do not offer complete color management. The fact that Safari is the only browser that again also full color profiles, a uniform, cross-platform representation for images in PNG format with embedded color profile is currently not possible. At least for the Firefox browser that this feature is planned for the future. Embedded gamma correction values ​​( GAMA chunks ), however, are free of errors detected and processed by most current browsers.

Technical details

The official reference library for the PNG format is libpng.

Header

A PNG file always begins with the following eight -byte signature ( magic number ):

This byte would abort the output, if the file would be spent, for example, with the MS-DOS TYPE command.

Compression

First PNG uses a pre-filter (see below), then the patent-free, lossless data compression method Deflate - the same algorithm, which is offered in the zlib compression library. This method was developed for the ZIP archive format and also found in gz format of the archive program gzip, in image format TIFF and many other programs use. So far Deflate is the only supported method. However, it is intentionally been left blank for extensions to support in future versions of PNG also other, more efficient or faster algorithms. To ensure backward compatibility with existing PNG - capable programs, is currently a recording of other methods in the standard but not planned. Compression can be specified ( in the program, as in the ZIP compression) in steps from 0 (none) to 9 (best).

Prefilter

To improve the compression of the image data, the PNG format supports various so-called pre-filter applied to the image data before the actual compression takes place.

In many images, adjacent pixels differ only slightly from each other. This means that the difference values ​​of pixels are quite small in magnitude. If now instead of the original pixel data, the difference values ​​are processed to the previous pixels, consequences often occur at the same values; important change will occur only relatively rare ( about the edges of objects ). This favors the compressibility of the data and is one of the reasons for the small size of PNG files.

PNG defined in the current version, five different types of filters:

The different filters are applied independently to each image line; often automatically selects the application program from a combination of filters. In many cases, the Paeth predictor provides the best results. The fourth type of filter is named after its inventor, Alan W. Paeth.

While extracting inverted versions of the filter are applied in order to restore the actual image data by the decompression of the data.

The pre-filters are the reason for the usually smaller footprint of PNG files against GIF files. However, many programs store PNG images are not optimally, resulting in unnecessarily large files. Various programs such as PNGOUT, ​​pngcrush, OptiPNG or others allow a lossless recompression and often much smaller files.

Benefits

  • There are no license fees.
  • The compression is lossless, while usually more compact than comparable formats.
  • Support for true-color (3 × 8 -bit color depth ) with a maximum of 3 × 16 -bit color depth.
  • Support for alpha transparency ( up to 16 bits, so 65,536 stages, are used 8 bit).
  • Support for color and brightness correction mechanisms to ensure that an image on different systems look nearly the same.
  • The format is subject to a fixed standard and is extensible so that, theoretically, any program must meet certain minimum requirements. In addition, PNG is both upward, and downward compatible, reducing incompatibilities between different versions.
  • Through integrated checksum is possible to detect errors in the file early.
  • PNG files are streamable, ie to interpret the file content is not random access, such as in many TIFF files necessary.
  • It is an optional 7 -pass interlacing by Adam M. Costello ( " Adam7 " ) available, ie the gradual re-display at the transmission over slow data lines. It occurred significantly less distortion than with GIF. Already at low transmission, a relatively reasonable display is already possible.
  • The support of all graphical web browser is available (in Internet Explorer Alpha transparency is however supported since version 7.0).

Disadvantages

  • Greater complexity of the file format in comparison to GIF.
  • As a partial alternative to the GIF format, it offers no possibility for animation. For this, the MNG format was created, which is hardly supported, as the APNG format.
  • Supports the CMYK color model and therefore is not not suitable as a complete TIFF replacement.
  • Supports indeed embedded metadata, but neither match the exif still the IPTC standard.
  • Does not allow easy loading of image parts. If you want to load only a section of the image must mitladen all image lines before. In the case of PNG files that are not sequential, but interlaced saved, even needs to be charged more.
  • The format does not reach naturally the compression ratios of lossy algorithms, such as JPEG for certain types of images (eg photos). Also in comparison with certain classes of image data specialized algorithms, such as only for scanned documents (eg JBIG2 ), PNG can not keep up mostly.

Related formats

  • MNG (Multiple- image Network Graphics ) stores animations.
  • JNG (JPEG Network Graphics ), a sub- format of MSG, supports the lossy part of the JPEG compression method.
  • APNG ( Animated Portable Network Graphics) support animation, but is backwards compatible with PNG. Pure PNG decoder show only the first frame of the animation.
  • PNG ( plus PNG ) is one of Microsoft Picture It! used file format that can store additional levels and multi-page layouts. It is incompatible with PNG and is used by almost any program any Picture It! supported.

Neither MNG, JNG, nor APNG or PNG are W3C recommendations.

Pictures of Portable Network Graphics

18854
de