Detailed explanation of the benefits of PNG in various network image formats

Detailed explanation of the benefits of PNG in various network image formats

BMP is an image file format that is independent of hardware devices and is widely used. It uses a bit-mapped storage format and does not use any other compression except for the optional image depth. Therefore, the BblP file occupies a large space. The image depth of BMP files can be 1 bit, 4 bit, 8 bit and 24 bit. When a BMP file stores data, the image is scanned from left to right and from bottom to top.
Since the BMP file format is a standard for exchanging image-related data in the Windows environment, all graphics and image software running in the Windows environment support the BMP image format.
A typical BMP image file consists of three parts: a bitmap file header data structure, which contains information such as the type and display content of the BMP image file; a bitmap information data structure, which contains information such as the width, height, compression method, and color definition of the BMP image.


JPEG compression technology can be said to be the basis of all image compression technologies. It is suitable for static image compression, directly processing the entire picture, with a compression ratio of 20-80 times, and there is no choice of resolution. Therefore, it is necessary to wait until the entire compressed file is transferred before decompressing it into an image. This method causes it to take tens of seconds or even minutes to transfer a high-resolution image.


MJPEG (Motion JPEG) is a dynamic image compression technology developed based on JPEG. It only compresses a certain frame and basically does not consider the changes between different frames in the video stream. This allows for the acquisition of high-definition video images, and the video definition and compression frame rate for each channel can be flexibly set. The compressed images can also be edited at will. But its defects are also very obvious. First, it has serious frame loss and poor real-time performance. It is difficult to complete real-time compression while ensuring that each channel must be high-definition. Second: The compression efficiency is low and the storage space is large.


Later, multi-layer JPEG (ML-JPEG) compression technology emerged. It uses a progressive technology to first transmit low-resolution images and then supplement them with more detailed compressed data to improve image quality. This method takes the same amount of time as the original method. However, since users can see the picture first, they will find this method better.


PNG is an image file storage format developed in the mid-1990s. Its purpose is to replace the GIF and TIFF file formats, while adding some features that the GIF file format does not have. The name of the Portable Network Graphic Format (PNG) comes from the unofficial "PNG's Not GIF". It is a bitmap file storage format pronounced "ping". When PNG is used to store grayscale images, the depth of the grayscale images can be up to 16 bits. When storing color images, the depth of the color images can be up to 48 bits, and up to 16 bits of alpha channel data can also be stored. PNG uses a lossless data compression algorithm derived from LZ77.


The PNG file format retains the following characteristics of the GIF file format:

Color images with 256 colors can be supported using a color lookup table or palette.
Streamability: The image file format allows continuous reading and writing of image data, which is very suitable for generating and displaying images during communication.
Progressive display: This feature allows the image to be displayed on the terminal while the image file is transmitted on the communication link. After the entire outline is displayed, the details of the image are gradually displayed. That is, the image is displayed at a low resolution first, and then its resolution is gradually increased.
Transparency: This property allows certain parts of an image to not be displayed, which can be used to create some distinctive images.
Ancillary information: This feature can be used to store some text annotation information in the image file.
Independent of computer hardware and software environment.
Use lossless compression.


The PNG file format needs to add the following features that the GIF file format does not have:

True color images with 48 bits per pixel.
Grayscale image with 16 bits per pixel.
You can add an alpha channel to grayscale and true color images.
Add gamma information of the image.
Use cyclic redundancy code (CRC) to detect damaged files.
Successive approximation display mode that speeds up 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 field and three or more data chunks organized in a specific structure.


PNG defines two types of data chunks, one is called the critical chunk, which is a standard data chunk, and the other is called ancillary chunks, which is an optional data chunk. The key data block defines four standard data blocks. Every PNG file must contain them, and all PNG reading and writing software must also support these data blocks. Although the PNG file specification does not require PNG codecs to encode and decode optional data blocks, the specification encourages support for optional data blocks.


The original meaning of GIF (Graphics Interchange Format) is "Image Interchange Format", which is an image file format developed by CompuServe in 1987. The data of GIF file is a continuous tone lossless compression format based on LZW algorithm. Its compression rate is generally around 50% and it does not belong to any application. Almost all relevant software currently supports it, and there is a large amount of software in the public domain that uses GIF image files. The data of GIF image files is compressed, and compression algorithms such as variable length are used. Therefore, the image depth of GIF ranges from 1 bit to 8 bits, which means that GIF supports images with up to 256 colors. Another feature of the GIF format is that it can store multiple color images in one GIF file. If the multiple image data stored in a file are read out one by one and displayed on the screen, it can form the simplest animation.


GIF is divided into static GIF and animated GIF. It supports transparent background images, is suitable for multiple operating systems, and is very small in size. Many small animations on the Internet are in GIF format. In fact, GIF saves multiple images into one image file to form an animation, so in the final analysis GIF is still a picture file format.

<<:  In-depth study of how to use positioning in CSS (summary)

>>:  Overview and differences between html inline elements and html block-level elements

Recommend

Teach you MySQL query optimization analysis tutorial step by step

Preface MySQL is a relational database with stron...

Implementation steps of encapsulating components based on React

Table of contents Preface How does antd encapsula...

CSS3 realizes the graphic falling animation effect

See the effect first Implementation Code <div ...

Python Flask WeChat applet login process and login api implementation code

1. Let’s take a look at the effect first Data ret...

Writing methods that should be prohibited in native JS

Table of contents Block-level functions Directly ...

How to enable or disable SSH for a specific user or user group in Linux

Due to your company standards, you may only allow...

How to change $ to # in Linux

In this system, the # sign represents the root us...

Select web page drop-down list and div layer covering problem

Questions about select elements in HTML have been...

Solve the problem of mysql data loss when docker restarts redis

Official documentation: So mysql should be starte...

A brief discussion on the use of GROUP BY and HAVING in SQL statements

Before introducing the GROUP BY and HAVING clause...

How to encapsulate timer components in Vue3

background When you open the product details on s...

Nginx URL rewriting mechanism principle and usage examples

URL rewriting helps determine the preferred domai...