OrderedDithererBayer8x8 Property

KGy SOFT Drawing Libraries Help
Gets an OrderedDitherer using the standard Bayer 8x8 matrix.
See the Examples section for some examples.

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

public static OrderedDitherer Bayer8x8 { get; }

Property Value

Type: OrderedDitherer
Examples

The following example demonstrates how to use the ditherer returned by this property:
C#
public static Bitmap ToDitheredBayer8x8(Bitmap source, IQuantizer quantizer)
{
    IDitherer ditherer = OrderedDitherer.Bayer8x8;

    // 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 Bayer 8x8 ordered dithering
Quantizing with black and white palette

Grayscale color shades with 2 BPP grayscale palette, using nearest color lookup and Bayer 8x8 ordered dithering
Quantizing with 4-color grayscale palette

Shield icon with transparent background
Shield icon with transparency

Test image "Lena"
Original test image "Lena"

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

Reference