Dithering
Testing some algorithms for dithering
From Wikipedia:
Dither or dithering is an intentionally applied form of noise used to randomize quantization error, preventing large-scale patterns such as color banding in images. Dither is routinely used in processing of both digital audio and video data, and is often one of the last stages of mastering audio to a CD.
A common use of dither is converting a grayscale image to black and white, so that the density of black dots in the new image approximates the average gray level in the original.
I implemented the “classic” error-diffusion algorithms (i.e. Floyd-Steinberg, Atkinson, Sierra, etc.), Bayer-matrices and noise-dithering algorithms.
All of them are parallelized with numba, making the first function call quite long, but then we process images of dimensions 1000x1000px in less than 50ms. This is not real time, but pretty close.
Results
We output the input image in B&W (Of course, we can run it in RGB or grayscale, but it is way less interesting to look at). Have a big zoom on one of the below image to understand that here, “black and white” means really black and white.

Error-Diffusion
| Algorithm | Output | Algorithm | Output |
|---|---|---|---|
| Floyd-Steinberg | ![]() | Atkinson | ![]() |
| Sierra | ![]() | Jarvis-Judice-Ninke | ![]() |
Bayer
| Algorithm | Output | Algorithm | Output |
|---|---|---|---|
| Bayer 2x2 | ![]() | Bayer 4x4 | ![]() |
| Bayer 8x8 | ![]() | Bayer 16x16 | ![]() |
| Dots | ![]() | Void and clusters | ![]() |
Noise
| Noise distribution | Output | Noise distribution | Output |
|---|---|---|---|
| Blue | ![]() | Pink | ![]() |
| Red | ![]() | Violet | ![]() |
| White | ![]() | Custom | ![]() |
At one point I’ll explain a bit what you see here…
















