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

Detailed explanation of MySQL/Java server support for emoji and problem solving

This article describes the support and problem so...

Vue realizes web online chat function

This article example shares the specific code of ...

Differences between ES6 inheritance and ES5 inheritance in js

Table of contents Inheritance ES5 prototype inher...

Implementation of interactive data between QT and javascript

1. Data flows from QT to JS 1. QT calls the JS fu...

MySQL 5.7.16 ZIP package installation and configuration tutorial

This article shares the installation and configur...

Seven solutions for classic distributed transactions between MySQL and Golan

Table of contents 1. Basic theory 1.1 Transaction...

Use scripts to package and upload Docker images with one click

The author has been working on a micro-frontend p...

How to make a website front end elegant and attractive to users

The temperament of a web front-end website is a fe...

Four solutions for using setTimeout in JS for loop

Table of contents Overview Solution 1: Closures S...

Detailed explanation of SSH password-free login configuration under Linux

Assume there are two Linux servers A and B, and w...

Vue method to verify whether the username is available

This article example shares the specific code of ...

WeChat applet implements countdown for sending SMS verification code

This article shares the specific code for the WeC...

Object-Oriented Programming with XHTML and CSS

<br />If only XHTML and CSS were object-orie...