PNG is an image file storage format developed in the middle of 1990s. It aims to replace GIF and TIFF file formats and add features not available in GIF file formats. Stream Network Graphics format
(Portable network graphic format, PNG) The name is from the unofficial "PNG's not GIF". It is a bitmap file storage format and is read as "ping ". When PNG is used to store a grayscale image, the depth of the grayscale image can be up to 16 bits. When the color image is stored, the depth of the color image can be up to 48 bits, it can also store up to 16-bit alpha channel data. PNG uses lossless data compression derived from lz77 Algorithm .
The PNG file format retains the following features of the GIF file format:
You can use a color search table or a color palette to support color images of 256 colors.
Stream read/write performance (streamability): The image file format allows continuous reading and writing of image data, which is suitable for generating and displaying images during communication.
Progressive display: This feature enables you to display images on the terminal while transmitting image files on the communication link. After the entire outline is displayed, the image details are gradually displayed, that is, first display the image with low resolution, and then gradually improve its resolution.
Transparency: This performance prevents certain parts of the image from being displayed and is used to create distinctive images.
Ancillary information: this feature can be used to store text comments in image files.
Independent from the computer software and hardware environment.
Use lossless compression.
Add the following features not available in the GIF file format:
Each pixel is a 48-bit real-color image.
Each pixel is a 16-bit grayscale image.
You can add Alpha channels for Grayscale and true color graphs.
Add the Gamma information of the image.
Use the Cyclic Redundancy Code (CRC) to detect damaged files.
Accelerate the display method of the image display.
Standard read/write toolkit.
Multiple images can be stored in one file.
File structure
A png Image Format File (or data stream) consists of an 8-byte PNG file signature domain and more than three chunks organized according to a specific structure.
PNG defines two types of data blocks. One is critical chunk, which is a standard data block, and the other is ancillary chunks ), this is an optional data block. Key data blocks define four standard data blocks. Each PNG file must contain them. PNG read/write software must also support these data blocks. Although the PNG file specification does not require the PNG encoding/Decoding of optional data blocks, the specification advocates the support of optional data blocks.