ErrorDiffusionDithererStucki Property

KGy SOFT Drawing Libraries Help
Gets an ErrorDiffusionDitherer instance using the filter proposed by P. Stucki in 1981. Uses a 5x3 matrix so the processing is slower than by the original Floyd-Steinberg filter but distributes errors in a wider range.
See the Examples section for some examples.

Namespace:  KGySoft.Drawing.Imaging
Assembly:  KGySoft.Drawing (in KGySoft.Drawing.dll) Version: 5.1.0

public static ErrorDiffusionDitherer Stucki { get; }

Property Value

Type: ErrorDiffusionDitherer

The following example demonstrates how to use the ditherer returned by this property:
public static Bitmap ToDitheredStucki(Bitmap source, IQuantizer quantizer)
    IDitherer ditherer = ErrorDiffusionDitherer.Stucki;

    // a.) this solution returns a new bitmap and does not change the original one:
    return source.ConvertPixelFormat(quantizer.PixelFormatHint, quantizer, ditherer);

    // b.) alternatively, you can perform the dithering directly on the source bitmap:
    source.Dither(quantizer, ditherer);
    return source;

The example above may produce the following results:

Original imageQuantized and dithered image

Color hues with alpha gradient
Color hues with alpha gradient

Grayscale color shades with different bit depths
Grayscale color shades

Grayscale color shades with black and white palette using Stucki dithering
Quantizing with black and white palette

Tip Tip
See the Remarks section of the ErrorDiffusionDitherer class for more details and examples.
See Also