How Is Image Dithering Computed?

  • Thread starter Thread starter peter.ell
  • Start date Start date
  • Tags Tags
    Image
Click For Summary
Dithering is a technique used in digital imaging to create the illusion of a wider color range from a limited palette. It works by diffusing quantization error—essentially the difference between the original color and the closest available color—across neighboring pixels. This process ensures that the average color in a given area closely resembles the intended color. For example, when representing purple (which is not directly available in a palette limited to red and blue), dithering spreads the red and blue values throughout the image, allowing the viewer to perceive purple. The Floyd–Steinberg dithering algorithm specifically diffuses this error to neighboring pixels in a calculated manner, enhancing the visual quality of the image despite the limited color options. This method effectively utilizes the concept of color spaces to find the nearest color representation within the constraints of the palette.
peter.ell
Messages
42
Reaction score
0
After reading about how dithering works for created the sense of a larger range of colors from a small color palette, it makes sense how it works, but how in the world do computers figure out how to dither an image so that it looks correct to us?

Is the fact that blue and red combined create the sense of purple just programmed, or how does it come about so that an image capture with no dithering gets dithered to correctly give the impression of certain colors?

Thank you so much!
 
Technology news on Phys.org
Colors have their own "space", so given a limited palette you can find the closest color just like you'd find the closest point in any other space.

What dithering does is diffuse the quantization error (how far off it is from the original) of a pixel to the neighboring pixels so that the average over an area of the image remains close to the original.

So for example Floyd–Steinberg diffuses the error to neighboring pixels like this:
[0,0,0]
[0,0,a]
[b,c,d]

Where a = 7/16, b = 3/16, c = 5/16, d = 1/16.

You'll also notice that it only diffuses the error to the bottom right, thus leaving already quantized pixels alone when you process the image from left-to-right and top-to-bottom.

Take the example of purple being dithered to a palette containing only Red and Blue:
Purple Value: (255,0,255)

By definition purple is a mixture of red and blue. Our palette doesn't have (255,0,255) so a single pixel can not represent it exactly, so we diffuse Red (255,0,0) and Blue (0,0,255) throughout space so that on average it comes out looking purple.
 
Last edited:
DavidSnider said:
Colors have their own "space", so given a limited palette you can find the closest color just like you'd find the closest point in any other space.

What dithering does is diffuse the quantization error (how far off it is from the original) of a pixel to the neighboring pixels so that the average over an area of the image remains close to the original.

So for example Floyd–Steinberg diffuses the error to neighboring pixels like this:
[0,0,0]
[0,0,a]
[b,c,d]

Where a = 7/16, b = 3/16, c = 5/16, d = 1/16.

You'll also notice that it only diffuses the error to the bottom right, thus leaving already quantized pixels alone when you process the image from left-to-right and top-to-bottom.

Take the example of purple being dithered to a palette containing only Red and Blue:
Purple Value: (255,0,255)

By definition purple is a mixture of red and blue. Our palette doesn't have (255,0,255) so a single pixel can not represent it exactly, so we diffuse Red (255,0,0) and Blue (0,0,255) throughout space so that on average it comes out looking purple.

Thank you. I appreciate your answer, it was very helpful.

All the best!
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

Replies
17
Views
5K
  • · Replies 3 ·
Replies
3
Views
3K
Replies
6
Views
3K
  • · Replies 0 ·
Replies
0
Views
1K
  • · Replies 19 ·
Replies
19
Views
917
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 4 ·
Replies
4
Views
11K