Why dithering is needed for digital images



In digital images, there is a technique called '

dithering ' that is used to reduce the number of colors in an image or replace them with different colors. Design engineer Dan Hollick explains what dithering is and why it is necessary.

Why do we need dithering? | Dan Hollick
https://typefully.com/DanHollick/why-do-we-need-dithering-Ut7oD4k

One of the methods for representing color in digital images is 'RGB (Red, Green, Blue).' RGB uses 8 bits for each of the three elements of red, green, and blue, for a total of 24 bits, allowing for the expression of approximately 16.7 million colors. However, not all colors can be expressed using RGB. In environments where only a limited number of colors can be used, such as old game consoles and early web image formats, it was necessary to create images that looked as smooth as possible within the constraints of just 16 or 256 colors.

Reducing the number of colors in an image by substituting colors with a limited palette or low bit depth is called 'quantization.' While quantization can reduce the number of bits, it can also create abrupt color changes where there should be gradual gradations. Dithering is a technique that approximates gradations by adding noise to two adjacent colors, exploiting the human optical illusion of 'making non-existent colors appear to exist.'

Below is a comparison of full color using 16.7 million colors (left), web-safe colors drawn using only 2.16 million colors (center), and web-safe colors after dithering (right). The smooth gradient of full color results in steps when using web-safe colors, but dithering creates a gradient closer to full color. The yellow square in the image is a sample of a single pixel of color enlarged from the gradient. In full color, it is a uniform yellow, but with web-safe colors, the limited number of colors available makes the differences between similar colors more obvious, resulting in a stepped appearance. Dithering, therefore, creates a smoother appearance by scattering fine noise within the pixels.



Holick gives the example of '

ordered dithering ' as a basic way to understand dithering. Ordered dithering adds noise using a set pattern rather than randomly, creating a small table called a 'Bayer matrix' that represents the order in which pixels are processed. After scaling the colors available for the Bayer matrix, a brightness threshold is determined.

The image to be rendered is divided into 2x2 pixel groups, and then a Bayer matrix is compared to a table of threshold values to systematically determine which pixels to brighten and which to darken. This allows, for example, the various shades of gray in a monochrome image to be reproduced using only the distribution of black and white.



While ordered dithering has the advantage of being computationally lightweight and producing uniform patterns, it has the disadvantage that the patterns generated by the threshold map are quite noticeable.

Floyd-Steinberg dithering is an approach that reduces the visibility of dithering. It uses an error diffusion mechanism: if a pixel is much brighter than the original pixel, it compensates by darkening neighboring pixels, resulting in an overall quantization error approaching zero.

There are several other dithering algorithms, including Jarvis-Judith-Ninke error diffusion, which distributes error over a wide range of surrounding pixels; Stucki error diffusion, a simpler and faster wide-area error diffusion; and Atkinson error diffusion, a fast and lightweight error diffusion method that distributes error over a small number of surrounding pixels.



However, with the rise of high-bit-depth color, which offers smoother color reproduction than full color, Holick says, 'Dithering is no longer necessary. It just creates a retro aesthetic.'

in Design, Posted by log1e_dh