
Image Scaling Algorithms: Nearest, Bilinear, Bicubic, and Lanczos
Enlarging an image requires new pixel values that were not in the original. Reducing one requires discarding detail without turning fine patterns into false shapes. Both operations are forms of signal reconstruction and resampling, so the selected filter determines sharpness, blur, aliasing, and ringing.
Japanese original published: 2026-04-27
Why scaling is more than changing a grid size
A raster image is a finite array of samples. A 100 × 100 image enlarged to 200 × 200 needs four times as many output pixels, while a reduction must combine information from many source pixels.
- Upscaling: reconstruct values between existing samples.
- Downscaling: remove frequencies that the smaller grid cannot represent, then resample.
Treating the source as a sampled continuous signal explains why no single method is best for every image.
Nyquist–Shannon and aliasing
The sampling theorem associated with Harry Nyquist and Claude Shannon states that a band-limited signal must be sampled above twice its highest frequency for lossless reconstruction. Frequencies above the new Nyquist limit fold into lower frequencies when an image is reduced without sufficient filtering.
In pictures this appears as moiré, jagged diagonal edges, flickering detail, or a fine pattern changing into a different pattern. Conceptually, high-quality reduction is therefore:
low-pass filter → sample on the smaller grid
Nearest-neighbour: preserve the pixels
Nearest-neighbour chooses the source pixel closest to each output coordinate.
output(x, y) = input(round(x / scaleX), round(y / scaleY))
It is fast and never invents intermediate colours. That is exactly what pixel art, masks, and many diagrams need. On photographs it creates blocky enlargement, and careless reduction can alias badly.
Bilinear: blend four neighbours
Bilinear interpolation blends the four surrounding pixels. If fx and fy are the fractional distances within the source cell:
output = (1-fx)(1-fy) I00
+ fx (1-fy) I10
+ (1-fx) fy I01
+ fx fy I11
It is inexpensive and widely accelerated by graphics hardware. The trade-off is visible softening, especially after repeated transformations.
Bicubic and Mitchell–Netravali: a family of cubic filters
Bicubic interpolation normally uses a 4 × 4 neighbourhood and a separable cubic kernel. “Bicubic” is a family name rather than one universal filter: different parameters change sharpness, blur, and ringing.
Catmull and Rom described a local interpolating spline in 1974, Keys published a widely used cubic-convolution formulation in 1981, and Mitchell and Netravali described a two-parameter family in 1988. Their commonly used balanced choice is B = 1/3, C = 1/3.
| Example | Typical character |
|---|---|
| Catmull–Rom | Sharp, interpolating, can ring around strong edges |
| Cubic B-spline | Smooth and relatively soft |
| Mitchell–Netravali | Balanced blur and ringing |
Lanczos: a windowed-sinc filter
The ideal band-limited reconstruction kernel is the sinc function, but its infinite support is impractical. A Lanczos kernel multiplies sinc by a second sinc window and limits it to a finite radius:
sinc(x) = sin(πx) / (πx)
L(x) = sinc(x) × sinc(x/a), |x| < a
a = 2 and a = 3 are common practical choices. Lanczos often preserves fine detail well during reduction, but strong transitions can produce light and dark halos. More lobes increase work and do not guarantee a more pleasing result for every image.
Choosing a filter
| Use | Practical starting point |
|---|---|
| Pixel art or indexed masks | Nearest-neighbour |
| Real-time texture display | Bilinear |
| General thumbnails | Bicubic or Mitchell–Netravali |
| Photographic reduction | Lanczos or a well-designed area filter |
| Large reductions | Area/box filtering or staged reduction |
| Large creative enlargement | AI super-resolution, with disclosure that detail is inferred |
Always inspect edges, thin lines, text, and repeating patterns. A filter that looks sharp on a portrait can create unacceptable halos on interface graphics.
CSS image-rendering controls intent, not one fixed kernel
img {
image-rendering: auto;
image-rendering: smooth;
image-rendering: high-quality;
image-rendering: pixelated;
image-rendering: crisp-edges;
}
CSS Images defines these values as rendering preferences. It does not require every browser and device to use an identical mathematical kernel. Use pixelated when preserving hard pixel boundaries matters, then test the target browsers and scale factors.
AI enlargement does not recover ground truth
Super-resolution models can generate plausible texture using patterns learned from training data. That can produce attractive results, but the extra detail is inferred rather than measured from the source.
For evidence, scientific measurement, medical work, or any task where fidelity matters more than appearance, retain the original and use a deterministic resampling method whose behaviour can be documented.
Summary
- Scaling reconstructs a signal and samples it on a new grid.
- Reduction needs low-pass filtering to limit aliasing.
- Nearest preserves discrete pixels; bilinear is fast but soft.
- Bicubic names a family of cubic filters with different trade-offs.
- Lanczos is a practical windowed-sinc filter that can be sharp but may ring.
- AI upscaling invents plausible detail and is not evidence recovery.
References and sources
- Nyquist (1928) — Certain Topics in Telegraph Transmission Theory ↗
- Shannon (1949) — Communication in the Presence of Noise ↗
- Keys (1981) — Cubic Convolution Interpolation for Digital Image Processing ↗
- Mitchell and Netravali (1988) — Reconstruction Filters in Computer Graphics ↗
- W3C CSS Images Module Level 4 — image-rendering ↗
Editorial note
This article was prepared with AI assistance and reviewed by an editor before publication. It may still contain factual errors, interpretation mistakes, or outdated information. Check the cited primary sources or official documentation before making an important decision.

