
lossless, lossy compression

Lossless compression and lossy compression are two types of digital image file compression.

1. Introduction
2 The principle of compression
lossy compression
lossless compression
3 advantages and disadvantages of compression
Introduction
Lossless compression is the compression of the file itself. Like other data file compression, it is to optimize the file’s data storage method. A certain algorithm is used to represent the repeated data information. The file can be fully restored without affecting the content of the file As far as the image is concerned, there will be no loss of image detail.
Lossy compression is a change in the image itself. When saving the image, more brightness information is retained and the color hue and purity information is merged with the surrounding pixels. The melting ratio is different and the compression ratio is also different. different The amount is reduced, so the compression ratio may be high and the image quality will be reduced accordingly.
compression principle
lossy compression
Lossy compression reduces the amount of space an image occupies in memory and on disk, and when viewed on screen, you won’t notice that it has a detrimental effect on the image’s appearance. Because human eyes are more sensitive to light, the effect of light on the scene is more important than the effect of color, which is the basic foundation of lossy compression technology.
lossless compression
The basic principle of lossless compression is that the same color information should only be saved once. The software that compresses the image first determines which areas of the image are the same and which are different. Images that include repetitive data (eg blue sky) can be compressed, only the beginning and end of the blue sky need to be recorded. But there can be different shades of blue, and the sky can sometimes be obscured by trees, mountains, or other objects, which must be recorded separately. Essentially, lossless compression methods eliminate some duplication and greatly reduce the size of the image that will be saved to disk. However, the lossless compression method does not reduce the memory consumption of the image, because when the image is read from disk, the software fills in the missing pixels with the appropriate color information. If you want to reduce the amount of memory an image occupies, you should use a lossy compression method.
pros and cons of compression
lossy compression
Lossy compression is characterized by maintaining gradual color changes and eliminating sudden color changes in the image. Numerous experiments in biology have shown that the human brain fills in missing colors with colors closest to the neighborhood. For example, for a white cloud against a blue sky background, lossy compression removes some of the color at the edges of the image scene. Looking at the image on the screen, the brain fills in the missing parts of the color with the colors it sees in the scene. By using lossy compression techniques, some data is intentionally deleted and the deleted data is never recovered.
It is true that the use of lossy compression techniques can greatly compress the data in a file, but at the expense of image quality. If the image using lossy compression is only displayed on the screen, it may not have much of an impact on the image quality, at least to the degree of recognition by the human eye. However, if an image that has been subjected to lossy compression techniques is printed on a high resolution printer, the quality of the image will be severely compromised.
lossless compression
The advantage of the lossless compression method is that the image quality can be preserved better, but the compression rate of this method is relatively low. However, if you need to print the image on a high-resolution printer, it’s best to use lossless compression. Almost all image files use their respective short-form names as file extensions. From the extension you can know what format the image is stored in, what software should be used to read/write, etc.



