Imgix APIsRendering APIBlendingBlend Resize Filter

Blend Resize Filter

blend-resize-filter

Sets the resampling kernel used when the blend layer image is resized. The default is lanczos2.

Use blend-resize-filter[N] to set the kernel for a specific blend layer.

?w=800&blend[1]=texture.png&blend-w[1]=100&blend-resize-filter[1]=nearest

Accepted values

ValueAliasesBest for
lanczos2—Default. Photographic layers. A good balance of sharpness and freedom from artifacts.
lanczos3lanczos, photo, sharpA sharper result than lanczos2, at the cost of more ringing around high-contrast edges.
bicubiccubic, catmull-romSmooth gradients with moderate sharpening.
mitchellgraphic, softSofter output with less ringing. Useful for graphics and flat color.
bilinearlinearFast and smooth, noticeably softer than the cubic and lanczos kernels.
nearestpixelHard edges with no interpolation. The right choice for pixel-art badges, QR codes and UI screenshots.

Values are matched exactly and are case-sensitive. A value that matches nothing — including a correctly spelled kernel in the wrong case, such as NEAREST — is ignored, and the layer resizes with the default lanczos2 instead of returning an error. These are the same values resize-filter takes for the base image.

Upscaling a small layer

The kernel matters most when a layer is enlarged, because every output pixel has to be invented from a handful of source pixels. The demo below takes a 40-pixel-wide pineapple and blends it in at 360 pixels: lanczos2 interpolates between the source pixels and softens the result, while nearest repeats each one as a solid block. The first entry is the same layer sourced at full size, for reference, and every other kernel is on the rows beneath.

A pineapple blend layer enlarged from a 40-pixel source with different resampling kernelsA pineapple blend layer enlarged from a 40-pixel source with different resampling kernels
◂▸
lanczos2nearest
Left
Right

Neither result is wrong — a photographic layer usually wants the interpolation and a pixel-art or UI layer usually does not.

Every kernel is there to switch between, but on an upscale the four smooth ones agree almost exactly: interpolating between the same handful of source pixels, lanczos3, bicubic, mitchell and bilinear all land within a pixel code or two of lanczos2. A downscale is where they separate, and resize-filter compares them there — a kernel behaves the same on a blend layer as it does on the base image.

Layers do not inherit the kernel

A blend layer resizes with lanczos2 unless blend-resize-filter is set for it, whatever resize-filter says for the base image. This holds even when blend-size=inherit makes the layer take the base image’s sizing parameters — the sizing is inherited, the kernel is not.