Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand JPEG Picture format

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

Today, I will talk to you about how to understand the JPEG picture format, many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

Introduction to JPEG

JPEG is a relatively mature image lossy compression format, after JPEG compression, the image quality will be lost, but it is not easy for human eyes to distinguish this difference. Jpeg images are relatively balanced in terms of quality and storage space. However, the jpeg file is a little more complex in terms of organization. Please read down for details.

How JPEG files are stored

Jpeg files are organized and stored according to the format of segments. Each file is composed of multiple segments, and each segment represents different information. At the same time, each segment has its own unique identifier. Identifiers are made up of two bytes in a format such as 0x FF XX, where XX represents different types. For example, SOI (start of image), which represents the beginning of an image, has a segment header whose identifier is 0X FF D8. The whole organization of jpeg images is made up of many of these different types of segments and data compressed by JPEG. If it is parsed, it also needs to be processed according to the different header types of these segments.

Main JPEG segment

1SOI

SOI (start of image): the value 0xFF D8 marks the beginning of the image.

2APP0 (application tag)

APP0: value 0x FF E0, application tag. The organizational structure is as follows:

3SOF

SOF (start of frame): value 0x FF C0, marking the beginning of the image frame.

Field and name byte length description

Segment flag 2 bytes fixed value: 0x FF C0 segment length 2 bytes does not include flag bit length precision (bits per pixel)

1 bytes is generally 8 image height

2 bytes image width in pixels 2 bytes color components in pixels

1 bytes grayscale: 1 YCbCr:3 CMYK:4 color component information number of color components * 3

Each color component:

1bytes: component ID

1bytes: horizontal and vertical sampling factor

1bytes: quantization table ID used by the current component

4SOS

Field and name byte number description data segment flag bit

2 bytes value: 0x FF DA, indicating the data length of the graph

2 bytes does not include flag bit length color component

1 bytes

Gray scale chart: 1

YCbCr: 3

CMYK: 4

Color component information 2 * number of color components

1bytes: id

1bytes: DC/AC coefficient table id

Spectrum selection start 1 bytes0x 00 Spectrum selection end 1 bytes0x 3F Spectrum selection 1 bytes0x 00

After SOS, it is the compressed data that is encoded according to jpeg. This part of the content needs to be decoded using the corresponding decoding library of jpeg.

In a jpeg file, if 0xFF D9 is encountered, it indicates that the entire file reading is over. This field also has a name called EOI (end of image), which takes up two bytes.

Of course, there are other segments in the whole jpeg file, which can also be analyzed by imitating the above.

After reading the above, do you have any further understanding of how to understand the JPEG picture format? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report