The official reference library for the PNG format is libpng
A PNG file always begins with the following eight byte signature (magic number):
Byte(s) in hex comment
50 4E 47 ASCII character string ‘ PNG ‘, allows the easy identification of the file format in text view or in a text editor.
0D 0A CR and LF, MS -DOS typical end of line
1A The End of File mark .
This byte would abort the output, if the file would be spent, for example, with the MS-DOS TYPE command.
First PNG uses a pre-filter, 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. So far deflate is the only supported method.
However, it is intentionally been left blank for extensions to support future versions of PNG and 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).
A PNG image with 256 colors, which is great thanks to prefilter of only 251 bytes. The same image as a GIF file would be more than three times as large.
To improve the compression of the image data, the PNG format supports various pre-filters 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 in values of pixels is 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 rarely occurs (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.
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 other, a lossless recompression and often much smaller files.
There are no license fees.
The compression is lossless, it is 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).
Support for color and brightness correction mechanisms to ensure that an image looks nearly the same on different systems.
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, it is possible to detect errors in the file early.
PNG files are streamable.
The support of all graphical web browsers is available (in Internet Explorer, Alpha transparency is however supported as from version 7.0).
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 embedded metadata, but neither match the exif and the IPTC standard.
Does not allow easy loading of image parts.
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 for scanned documents (eg JBIG2), PNG can not keep up.
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 + 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 Picture It! supported program.
Neither MNG , JNG , nor APNG or PNG + are W3C recommendations .