Image: differences between jpg png and gif bmp formats (1)

Source: Internet
Author: User
JPG
1. jpg full name should be JPEG

JPEG images store a single grating image in 24-bit color. JPEG is a platform-independent format that supports the highest level of compression. However, this compression is lossy. Gradient JPEG files can be staggered.

It can increase or decrease the level of JPEG file compression. However, the file size is at the cost of image quality. The compression ratio can be up to: 1. (The JPEG format allows you to easily compress files at a ratio of to, without compromising the image quality .) JPEG compression can well process realistic photography. However, JPEG compression cannot provide ideal results for simple works with a small color, strong contrast level, solid border, or a large solid color area. Sometimes, the compression ratio is as low as, seriously compromising image integrity. The cause of this loss is that the JPEG compression scheme can well compress similar tones, but the JPEG compression scheme cannot well handle the strong Brightness Difference or the solid color area.

Advantage: photographic or realistic works support advanced compression.

The variable compression ratio can be used to control the file size.

Supports interleaved (for gradient JPEG files ).

Internet standards are widely supported.

Disadvantage: lossy compression will reduce the quality of original image data.

When you edit and re-save a jpeg file, the quality of the original image data is decreased. This decline is cumulative.

JPEG is not applicable to simple images with very few colors, areas with similar color blocks, or with very obvious brightness differences.

JPG is a common image format. If your image is in another format, you can convert it using the following method:

1. Photoshop. After opening the image, save the image as needed. In the following format, select the JPG format. This method is simple and suitable for converting images with better image quality and higher requirements.

2. If you do not have high requirements, you can directly use the images attached to WindowsProgramSelect the JPG format. If you want to convert the image quality, the image quality will be very good. However, it can be done on the Internet!

If the JPG format is converted to another format, this method also applies.

JPEG (joint photographic Experts Group) is an International Standard Organization (ISO: International Standardization Organization) and CCITT: Consultation commitee of The International Telephone and Telegraph) the first international digital image compression standard established for static images is also the most widely used image compression standard. Since JPEG can provide lossy compression, the compression ratio can reach other traditional compression methods.AlgorithmIncomparable degree.

JPEG compression modes include the following:

Sequential Encoding)

The image is processed from left to right and from top to bottom at a time.

Progressive Encoding)

When the image is transmitted for a long time, the image score can be processed and transmitted in a fuzzy to clear manner (the effect is similar to the GIF transmission over the network ).

Lossless Encoding)

Hierarchical Encoding)

Images are compressed at several resolutions to enable high-resolution images to be displayed on devices with lower resolutions.

Since JPEG lossless compression is not better than other compression methods, we focus on its lossy compression. Taking a 24-bit color image as an example, the JPEG compression steps are divided:

1. Color Conversion

2. DCT Transformation

3. Quantization

4. Encoding

1. Color Conversion

Since JPEG only supports the data structure of the YUV color mode and does not support the data structure of the RGB image, you must convert the color mode before compressing the color image. The conversion of each value can be calculated using the following conversion formula:

Y = 0.299r + 0.587G + 0.114b

U =-0.169r-0.3313G + 0.5b

V = 0.5r-0.4187g-0.0813b

Y indicates the brightness, and U and V indicate the color.

Data Sampling is also required after the conversion. Generally, the sampling ratio is or. After performing this operation, only one row of data is retained for each two rows. Therefore, after sampling, the image data volume is compressed to half of the original size.

2. DCT Transformation

DCT (discrete consine Transform) is a process of transforming the image signal in the frequency field and separating the high-frequency and low-frequency information. Then, compress the high-frequency part of the image (that is, the image details) to compress the image data.

First, divide the image into multiple 8*8 matrices. Then perform DCT transformation on each matrix (the transformation formula is omitted ). After the conversion, a frequency coefficient matrix is obtained, where the frequency coefficient is a floating point number.

3. Quantization

Because the bitwise books used in subsequent encoding are integers, You need to quantify the transformed frequency coefficient and convert it to an integer.

After data quantification, the data in the matrix is an approximate value, which is different from the original image data. This difference is the main cause of image distortion after compression.

In this process, the selection of quality factors is very important. If the value is too large, the compression ratio can be greatly increased, but the image quality is relatively poor. On the contrary, the smaller the quality factor (minimum 1), the better the image reconstruction quality, but the lower the compression ratio. In this regard, ISO has developed a set for JPEGCodeThe standard quantization value used by the implementer.

4. Encoding

From the previous process, we can see that the image has not been further compressed before the color conversion is complete to encoding. DCT transformation and quantification can be said to be in preparation for the encoding phase.

Two encoding mechanisms are used: one is the stroke length encoding with 0 values, and the other is the entropy coding ).

In JPEG, the elements in the matrix are arranged by the qu-Shen sequence, that is, the elements in the matrix are arranged in the normal direction of the diagonal line of the matrix. In this way, elements close to the upper left corner of the matrix with relatively large values are arranged before the stroke, and the matrix elements arranged after the stroke are basically 0 values. Travel length encoding is a simple and common encoding method.

Encoding is actually a statistical feature-based encoding method. In JPEG, Huffman encoding or arithmetic encoding is allowed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.