Floyd-Steinberg dithering

From Wikipedia, the free encyclopedia

Floyd-Steinberg is a dithering algorithm first published in 1976 by Robert W. Floyd and Louis Steinberg.

The algorithm achieves dithering by diffusing the quantization error of a pixel to its neighboring pixels. More specifically, 7/16 of it is added to the pixel to its right, 3/16 of it to the pixel to its lower left, 5/16 to the pixel below, and 1/16 to the pixel to its lower right.

For example, consider this matrix of pixel values:

\begin{bmatrix} 0.00 & 0.00 & 0.00 \\ 0.00 & 1.00 & 0.00 \\ 0.00 & 0.00 & 0.00 \end{bmatrix}

If the center value is quantized to zero and the error is diffused by the Floyd-Steinberg algorithm, this would be the result:

\begin{bmatrix} 0.00 & 0.00 & 0.00 \\ 0.00 & 0 & 0.44 \\ 0.19 & 0.31 & 0.06 \end{bmatrix}

Note that the whole algorithm should run in-place instead of accumulating the errors on a separate buffer.

[edit] External links

In other languages