GIMP Interpolation: Cubic vs NoHalo vs LoHalo

When scaling or transforming images in GIMP, interpolation algorithms reconstruct continuous visual signals from discrete pixel grids. The fundamental mathematical difference between the traditional Cubic method and GEGL’s NoHalo and LoHalo methods lies in their kernel formulation, dimensional separability, and how they handle overshoot artifacts (ringing) caused by negative kernel lobes.

Cubic Interpolation

Cubic interpolation (specifically Bicubic) evaluates pixels using a separable one-dimensional piecewise cubic polynomial applied sequentially along the Cartesian axes (rows, then columns). In GIMP, this typically implements a Keys cubic convolution kernel (often the Catmull-Rom spline, where parameter \(a = -0.5\)):

\[W(x) = \begin{cases} (a + 2)|x|^3 - (a + 3)|x|^2 + 1 & \text{for } |x| \le 1 \\ a|x|^3 - 5a|x|^2 + 8a|x| - 4a & \text{for } 1 < |x| < 2 \\ 0 & \text{otherwise} \end{cases}\]

Because the Catmull-Rom kernel contains negative lobes within the interval \(1 < |x| < 2\), the linear combination of adjacent pixel values can produce output values that exceed the local maximum or fall below the local minimum (\(f(x) \notin [\min(P), \max(P)]\)). Mathematically, this causes Gibbs-like ringing artifacts, appearing as bright or dark halos around high-contrast edges. Furthermore, its separable nature assumes grid-aligned transformations and does not natively adapt to arbitrary affine or projective geometric distortions.

NoHalo Interpolation

NoHalo is a non-separable, adaptive resampling algorithm developed for GIMP’s GEGL engine. It is designed around the principles of Elliptical Weighted Average (EWA) filtering combined with strict bound enforcement.

Mathematically, NoHalo differs from Bicubic in three distinct ways:

  1. Local Geometry Adaptation: Instead of processing axes independently, NoHalo calculates the local Jacobian matrix of the transformation mapping. It projects an ellipse onto the input sampling grid that accurately represents the footprint of the target pixel, preventing moiré and aliasing during severe downsampling.

  2. Directional Weighting: The reconstruction kernel aligns with the principal axes of the local gradient tensor, sampling more heavily along edges rather than across them.

  3. Strict Clamping (Zero Overshoot): To eliminate halos, NoHalo enforces a hard mathematical constraint. The reconstructed intensity value \(I\) is bounded strictly within the convex hull of the immediate neighborhood samples:

    \[I_{\text{NoHalo}} = \max\left(\min_{i \in N} P_i, \; \min\left(\max_{i \in N} P_i, \; I_{\text{filter}}\right)\right)\]

    By constraining the output to the interval \([\min(N), \max(N)]\), negative lobes cannot push values beyond the original local extrema, mathematically guaranteeing the complete absence of ringing halos at the expense of slight edge softening.

LoHalo Interpolation

LoHalo ("Low Halo") uses the same adaptive elliptical framework as NoHalo but alters the kernel blending function to preserve higher visual sharpness (acutance).

Instead of clamping pixel values strictly to the immediate neighborhood extrema, LoHalo calculates a dynamic threshold based on local variance and image gradients:

  1. Kernel Blending: LoHalo computes two simultaneous values: an anti-aliased, halo-free value \(I_{\text{clamped}}\) (similar to NoHalo) and a sharper, wide-support sinc- or Lanczos-like reconstructed value \(I_{\text{sharp}}\) containing standard negative lobes.

  2. Controlled Overshoot: Rather than clamping strictly to \([\min(N), \max(N)]\), LoHalo expands the permissible dynamic range by a mathematically bounded factor \(\epsilon\), derived from the local derivative:

    \[I_{\text{LoHalo}} = (1 - \alpha) I_{\text{sharp}} + \alpha I_{\text{clamped}}\]

    where \(\alpha \in [0, 1]\) is a non-linear weight determined by the magnitude of high-frequency components detected in the filter footprint.

In smooth gradient areas and mild transitions, \(\alpha\) approaches 0, allowing mild overshoot to preserve sharp edge contrasts. In extreme-contrast regions prone to noticeable artifacts, \(\alpha\) increases toward 1, suppressing the negative lobes before the ringing becomes perceptually offensive.

Summary of Differences

  • Kernel Topology: Cubic is separable and 1D-axis-aligned (\(f(x) \times f(y)\)); NoHalo and LoHalo are non-separable 2D elliptical filters adapted to the transformation matrix.
  • Extremum Preservation: Cubic permits unbounded overshoot (\(I < P_{\min}\) or \(I > P_{\max}\)); NoHalo enforces a strict bound (\(P_{\min} \le I \le P_{\max}\)); LoHalo permits a mathematically regulated degree of overshoot based on localized image variance.
  • Primary Use Case: Cubic is computationally lightweight for standard affine operations; NoHalo minimizes artifacts in drastic downsampling and high-contrast text; LoHalo provides the sharpest perceptual result for general downscaling without visible edge ringing.