Table of Contents

Enum ResampleFilter

Namespace
Egami.Operations
Assembly
Egami.dll

The kernel a resize or rotation uses to blend source pixels.

public enum ResampleFilter

Fields

Bicubic = 0

Keys cubic with a = −0.5 (Catmull-Rom): sharp, with slight ringing at hard edges. The default.

Bilinear = 3

A triangle (tent) kernel: smooth and soft, with no ringing.

Box = 2

Averages the source pixels each output pixel covers. Good for large reductions of flat artwork.

Gaussian = 8

A Gaussian with σ = ½, exp(−2x²), out to 2 pixels, as ImageMagick's Gaussian filter: soft, with no ringing at all.

GdiPlusBicubic = 11

As GDI+'s InterpolationMode.Bicubic, measured in 2.7.6: Keys cubic with a = −0.5 over the four nearest source pixels at every scale, so shrinking skips pixels instead of averaging them.

GdiPlusBilinear = 10

As GDI+'s InterpolationMode.Bilinear (and Default and Low), measured in 2.7.6: the tent between the two nearest source pixels at every scale, so shrinking skips pixels instead of averaging them.

GdiPlusHighQualityBicubic = 13

As GDI+'s InterpolationMode.HighQualityBicubic (and High), measured in 2.7.6: Keys cubic with a = −1, widened by the reduction when shrinking, convolved with a box one source pixel wide. Sharp, with slight ringing.

GdiPlusHighQualityBilinear = 12

As GDI+'s InterpolationMode.HighQualityBilinear, measured in 2.7.6: the tent, widened by the reduction when shrinking, convolved with a box one source pixel wide (the quadratic B-spline when enlarging). Soft, with no ringing.

Hermite = 7

The Hermite cubic (B = C = 0), 2|x|³ − 3|x|² + 1 out to 1 pixel: smooth like Bilinear when enlarging, without its corners, and no ringing.

Lanczos2 = 6

A two-lobe windowed sinc, sinc(x)·sinc(x / 2) out to 2 pixels, as ImageMagick's Lanczos2: nearly as sharp as Lanczos3 with less ringing, and faster.

Lanczos3 = 5

A three-lobe windowed sinc: the sharpest, with the most ringing, and the slowest.

Mitchell = 4

Mitchell–Netravali with B = C = 1/3: softer than Bicubic, with less ringing.

Nearest = 1

Picks the closest source pixel without blending. Exact and fastest; blocky when enlarging, aliased when shrinking.

Spline = 9

The cubic B-spline (B = 1, C = 0) out to 2 pixels: the smoothest cubic, with no ringing and noticeable blur.

Examples

// Lanczos3 is sharper than the default Bicubic; Nearest keeps hard pixel edges (pixel art, masks).
using Raster sharp = photo.Derive(ops => ops.Resize(200, 0, ResampleFilter.Lanczos3), Ct);

// Blending in linear light keeps fine bright detail on dark backgrounds from going dim when reduced.
using Raster linear = photo.Derive(ops => ops.Resize(200, 0, ResampleFilter.Mitchell, ColorSpace.Linear), Ct);