See the Remarks section for details and some image examples.
KGySoft.Drawing.ImagingOrderedDitherer
Namespace: KGySoft.Drawing.Imaging
Assembly: KGySoft.Drawing (in KGySoft.Drawing.dll) Version: 5.3.0
The OrderedDitherer type exposes the following members.
Name | Description | |
---|---|---|
![]() ![]() | OrderedDitherer |
Initializes a new instance of the OrderedDitherer class using the specified matrix and strength.
See the Examples section for some examples. |
Name | Description | |
---|---|---|
![]() ![]() ![]() | Bayer2x2 |
Gets an OrderedDitherer using the standard Bayer 2x2 matrix.
See the Examples section for some examples. |
![]() ![]() ![]() | Bayer3x3 |
Gets an OrderedDitherer using the standard Bayer 3x3 matrix.
See the Examples section for some examples. |
![]() ![]() ![]() | Bayer4x4 |
Gets an OrderedDitherer using the standard Bayer 4x4 matrix.
See the Examples section for some examples. |
![]() ![]() ![]() | Bayer8x8 |
Gets an OrderedDitherer using the standard Bayer 8x8 matrix.
See the Examples section for some examples. |
![]() ![]() ![]() | BlueNoise |
Gets an OrderedDitherer using a fixed 64x64 blue noise pattern of 256 different values.
See the Examples section for some examples. |
![]() ![]() ![]() | DottedHalftone |
Gets an OrderedDitherer using a 8x8 matrix of a dotted halftone pattern.
See the Examples section for some examples. |
Name | Description | |
---|---|---|
![]() ![]() | ConfigureStrength |
Gets a new OrderedDitherer instance that has the specified dithering strength.
See the Remarks section for details. |
The constructor can be used to create an ordered ditherer using a custom matrix.
Use the static properties to obtain an instance with a predefined pattern. For the best results use the Bayer8x8 or BlueNoise properties. Or you can use the DottedHalftone property for artistic results.
The OrderedDitherer class offers a very fast dithering technique based on an ordered pattern specified in a matrix of bytes. The more different values the matrix has the more number of different patterns can be mapped to the shades of the original pixels. While quantizing lighter and lighter colors, the different patterns appear in the order of the values in the specified matrix.
The following table demonstrates the effect of the dithering:
Original image | Quantized image |
---|---|
|
|
|
|
Unlike in case of the ErrorDiffusionDitherer, ordered dithering does not adjust strength to the quantization error of a pixel but simply uses the specified matrix values based on pixel coordinates to determine the quantized result. Therefore, a strength can be specified (see the constructor and the ConfigureStrength method), whose ideal value depends on the colors that a quantizer can return. If the strength is too low, then banding may appear in the result in place of gradients in the original image; whereas if the strength is too high, then dithering patterns may appear even in colors without quantization error (overdithering).
Every static property in the OrderedDitherer returns an instance with auto strength, meaning that strength will be calibrated for each dithering session so that neither the black, nor the white colors will suffer from overdithering in the result. The auto value is usually correct if the quantizer returns evenly distributed colors. To obtain an OrderedDitherer instance with custom strength use the ConfigureStrength method.
The following table demonstrates the effect of different strengths:
Original image | Quantized image |
---|---|
|
|
![]() |
---|
See the Examples section of the static properties for more examples. |