What is the format of png file?

Png is a bitmap format using lossless compression algorithm.

Png aims to replace GIF and TIFF file formats and add some functions that GIF file formats do not have. PNG adopts lossless data compression algorithm derived from LZ77. Because of its high compression ratio and small file size, PNG is generally used in JAVA programs, web pages or S60 programs.

PNG also supports Alpha channel transparency for true color and grayscale images. Supports up to 24-bit true color images and 8-bit grayscale images. Transparent/translucent supporting Alpha channel. Gamma calibration information supporting image brightness. Support the storage of additional text information, so as to retain information such as picture name, author, copyright, creation time, comments, etc.

PNG images are compared with other formats:

I. PNG and GIF

1. Generally speaking, the compression ratio will be slightly improved after the static GIF image is lossless converted to PNG (provided that the 8-bit index mode is also adopted).

2.PNG can provide support for greater color depth, including 24-bit (8-bit 3-channel) and 48-bit (16-bit 3-channel) true color. The addition of α channel can further support the representation of 64 bits per pixel.

3. When a PNG image with a color depth of more than 8 bits is converted into GIF, the image quality will be degraded due to color separation (the number of colors is reduced).

4.GIF natively supports dynamic images, and PNG can only be implemented through nonstandard. On the basis of PNG, APNG and MNG formats supporting animation are developed, but their popularity is not high. PNG is poorly supported on older browsers such as IE6.

Second, PNG and JPEG.

1 and JPEG can generate smaller files for photo (or similar) images, because JPEG uses a specific lossy coding method for photo images, which is suitable for situations with low contrast, smooth color transition, much noise and irregular structure.

If we use PNG instead of JPEG in this case, the file size will increase a lot, but the improvement of image quality is limited. Accordingly, if the saved text, lines or similar images have clear edges and the color areas of large blocks of images are the same, the compression effect of PNG format is much better than JPEG, and there will be no image loss in high contrast areas like JPEG. If an image has both clear edges and the characteristics of a photo image, it is necessary to weigh the two formats. JPEG does not support transparency.

2. Because JPEG is lossy compression, there will be iterative loss, and information will be lost continuously in the process of repeated compression and decoding, which will reduce the image quality. Because PNG is lossless, it is more appropriate to save the image to be edited.

Although PNG is also effective in compressing photo images, there are also lossless compression formats specially designed for photo images, such as lossless JPEG2000 and Adobe DNG. Generally speaking, these formats cannot be applied to all images. The image to be published can be saved as JPEG, and encoding with JPEG once will not cause obvious image loss.

Three. PNG and JPEG-LS

JPEG-LS is an "almost" lossless compression format. Compared with the above lossy JPEG compression, its popularity is not high. Using a set of standard test images, it can be directly compared with PNG. The performance of JPEG-LS is usually better than that of PNG 10%- 15% under Waterloo Repertoire ColorSet (a set of standard test images), but the performance of some images PNG is obviously better, about 50%-75%. Therefore, if both formats are supported and sensitive to the image file size, then both formats can be tried, which has a great relationship with the image data itself.

Four. PNG and TIFF

TIFF is a format that combines multiple schemes. It is widely used as an intermediate format for image exchange between professional image editing software, so it constantly supports the functions required by more applications, but there are not many image operations that are not concerned about applications. This also means that many applications can only recognize a subset of TIFF, which leads to more potential confusion.

The most commonly used lossless compression algorithm for TIFF is LZW. This algorithm-GIF is also used, and it was not patented until 2003. TIFF has a variant, which uses the same compression algorithm as PNG, but it is not supported by many patented programs. TIFF also provides a special lossless compression algorithm, similar to CCITTGroup IV, which can compress binary images (such as faxes or black and white text) better than PNG. PNG only supports non-self-left multiplication α, and TIFF also supports joint (self-left multiplication) α.

The PNG specification does not contain standards for embedded EXIF (exchangeable image file format) image data, such as images taken by digital cameras. TIFF, JPEG 2000 and DNG DNG all support EXIF.