Want to understand why a smoothing algorithm can reduce color depth?

Sometimes I have a true color image using the smoothing algorithm, I can reduce the color to 256. I want to know how the smoothing algorithm achieves this.

I understand that smoothing can reduce the error, but how the algorithm can reduce the color depth, especially from true color to 256 colors or even less.

+4
source share
2 answers

Anti-aliasing models a higher color depth by β€œblending” colors in a specific palette to create the illusion of a color that does not actually exist. In fact, it does the same thing your computer monitor already does: color, decomposing it into primary colors and displaying them next to each other. Your computer monitor does this with variable intensities of red, green, and blue, while anti-aliasing does this with a set of colors with a fixed intensity. Since your eye has a limited resolution, it sums up the inputs and you perceive the average color.

In the same way, a newspaper can print grayscale images by smoothing black ink. They do not need many intermediate grays to get a decent grayscale image; they simply use small or large dots of black ink on the page.

When you smooth the image, you lose information, but your eye perceives it basically the same way. In this sense, it is a bit like JPEG or other lossy compression algorithms that discard information that your eye does not see.

+6
source

Smoothing by itself does not reduce the number of colors. Rather, anti-aliasing is applied during the color-reduction process to reduce color-reduction artifacts.

A color that is halfway between two other colors can be modeled by a pattern that is half of one color and half of the other. This can be generalized to other percentages. A color that is a mixture of 10% of one color and 90% of another can be modeled because 10% of the pixels are the first color and 90% of the pixels are the second. This is due to the fact that the eye will consider random vibrations as noise and average them into the overall impression of the color of the area.

The most effective anti-aliasing algorithms will track the difference between the original image and the reduced color and take this difference into account when converting future pixels. This is called diffusion of errors - errors in the current pixel apply to transformations of other pixels.

The process of choosing the best 256 colors for conversion is different from smoothing.

+4
source

Source: https://habr.com/ru/post/1394930/


All Articles