High-quality compression & format conversion made simple!

(Diagrammatic Explanation) JPEG Image Compression Principle Technology

I believe many people are not unfamiliar with image formats. There are now many types of image formats, such as PNG, JPEG, etc. However, you may notice that for the same picture, when we use tools to convert it into other modes, the file size displayed in the computer file system is different. But when you open and view it, from a visual perspective, there is hardly any difference. So why is there a difference in the actual file size, yet the visual perception is almost the same? This involves a field: compression. Specifically for images, it is image compression technology. Today, let's briefly talk about the commonly used JPEG compression technology.


Common images are composed of the RGB format. Each pixel value on the image is represented by R (8 bits), G (8 bits), and B (8 bits), as shown in the figure:


(Diagrammatic Explanation) JPEG Image Compression Principle Technology


The following is a 2592×1944 image. The file size without any compression and using JPEG technology is:


(Diagrammatic Explanation) JPEG Image Compression Principle Technology


It is about 15M before compression, and only about 0.8M after compression.


Compression technique : Color space conversion

Some researchers have proved through a large number of experiments that the human visual system is more sensitive to brightness and seems less sensitive to color. For example, in the figure below, A and B are actually the same color.


(Diagrammatic Explanation) JPEG Image Compression Principle Technology


In this way, we can convert the image from the RGB space to the YCrCb space (Y: luminance, Cb: blue chrominance, Cr: red chrominance), reduce the sampling number of the Cr and Cb components, and for the luminance Y, retain the levels from 0 to 255. This technique is called chroma subsampling.


The following figure is the picture for color sampling. There seems to be no difference in the picture, but compared with the original picture, the storage space is compressed by nearly 50%.