Enum DitherMode
- Namespace
- Egami.Quantization
- Assembly
- Egami.dll
How the error of mapping pixels to a palette is spread: error diffusion (Floyd–Steinberg and eight other published kernels, and Riemersma's Hilbert-curve walk) or an ordered pattern (Bayer 2, 4, 8 and 16, and 3 × 3). The values are fixed.
public enum DitherMode
Fields
Atkinson = 3Atkinson's error diffusion (Apple, 1984): spreads six eighths of the error, so flat areas keep more contrast.
Bayer16x16 = 14A 16 × 16 ordered (Bayer) pattern: the finest steps, for large palettes.
Bayer2x2 = 12A 2 × 2 ordered (Bayer) pattern: coarse, visible cross-hatching.
Bayer4x4 = 13A 4 × 4 ordered (Bayer) pattern.
Burkes = 4Burkes' error diffusion (1988): two rows, 32nds.
FloydSteinberg = 0Floyd–Steinberg error diffusion: the smoothest gradients; frames of an animation dither one row after another.
JarvisJudiceNinke = 5Jarvis, Judice and Ninke's error diffusion (1976): three rows, 48ths; smooth but slow.
None = 2No dithering: each pixel takes the nearest palette color.
Ordered = 1An 8×8 ordered (Bayer) pattern: stable between animation frames and parallel, at some cost in quality.
Ordered3x3 = 15A 3 × 3 ordered pattern.
Riemersma = 11Riemersma's dithering (1998): error diffusion along a Hilbert curve with a 16-pixel memory, so no direction shows.
Sierra2 = 7Sierra's two-row error diffusion, 16ths.
Sierra3 = 6Sierra's three-row error diffusion (1989), 32nds.
SierraLite = 8Sierra's Filter Lite: three neighbours, quarters; nearly as smooth as Floyd–Steinberg and faster.
StevensonArce = 9Stevenson and Arce's error diffusion (1985), four rows, 200ths.
Stucki = 10Stucki's error diffusion (1981): three rows, 42nds; sharper than Jarvis, Judice and Ninke.
Examples
using FileStream output = File.Create("duck.gif");
photo.Save(output, GifFormat.Info, new GifWriterOptions
{
Palette = new PaletteOptions { MaxColors = 128, Dither = DitherMode.Ordered }, // FloydSteinberg (default), Ordered or None
PaletteScope = GifPaletteScope.PerFrame, // Auto (default): one table when all frames fit, else one per frame
});