Table of Contents

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 = 3

Atkinson's error diffusion (Apple, 1984): spreads six eighths of the error, so flat areas keep more contrast.

Bayer16x16 = 14

A 16 × 16 ordered (Bayer) pattern: the finest steps, for large palettes.

Bayer2x2 = 12

A 2 × 2 ordered (Bayer) pattern: coarse, visible cross-hatching.

Bayer4x4 = 13

A 4 × 4 ordered (Bayer) pattern.

Burkes = 4

Burkes' error diffusion (1988): two rows, 32nds.

FloydSteinberg = 0

Floyd–Steinberg error diffusion: the smoothest gradients; frames of an animation dither one row after another.

JarvisJudiceNinke = 5

Jarvis, Judice and Ninke's error diffusion (1976): three rows, 48ths; smooth but slow.

None = 2

No dithering: each pixel takes the nearest palette color.

Ordered = 1

An 8×8 ordered (Bayer) pattern: stable between animation frames and parallel, at some cost in quality.

Ordered3x3 = 15

A 3 × 3 ordered pattern.

Riemersma = 11

Riemersma's dithering (1998): error diffusion along a Hilbert curve with a 16-pixel memory, so no direction shows.

Sierra2 = 7

Sierra's two-row error diffusion, 16ths.

Sierra3 = 6

Sierra's three-row error diffusion (1989), 32nds.

SierraLite = 8

Sierra's Filter Lite: three neighbours, quarters; nearly as smooth as Floyd–Steinberg and faster.

StevensonArce = 9

Stevenson and Arce's error diffusion (1985), four rows, 200ths.

Stucki = 10

Stucki'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
});