Imgix APIsRendering APIWatermarkWatermark Resize Filter

Watermark Resize Filter

mark-resize-filter

Sets the resampling kernel used when the mark image is resized, including resizes driven by mark-scale. The default is lanczos2.

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

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 watermark 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 watermark

The kernel matters most when a watermark 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 places it at 240 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 watermark enlarged from a 40-pixel source with different resampling kernelsA pineapple watermark enlarged from a 40-pixel source with different resampling kernels
◂▸
lanczos2nearest
Left
Right

Neither result is wrong — a photographic badge usually wants the interpolation and a pixel-art one 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 watermark as it does on the base image.

Layers do not inherit the kernel

A watermark resizes with lanczos2 unless mark-resize-filter is set for it, whatever resize-filter says for the base image. The two are independent, which is what lets a pixel-art badge stay crisp while the photograph behind it resizes normally:

?w=800&mark=badge.png&mark-w=96&mark-resize-filter=nearest