ComfyUI Node

Resampler | Lanczos

Lanczos, done properly

By wmpmiles·Created 2 years ago·Updated about a year ago· 5
Resampler | Lanczos
    • resampler
    radius3

    Resampler | Lanczos is the filter most people mean when they say "just upscale it nicely." It's the classic sharp, high-quality resampling kernel - the one image editors use as their good default - and it's the most-searched node in this pack for a reason. It's not generative, it can't invent detail, and that's the point: when your source already has the detail and you just need more pixels, Lanczos is the honest, fast answer. The upscaling essay's "more pixels, source already sharp" row could have this node's name on it.

    What makes this implementation notable is that it runs the filter in linear-light sRGB. The Resample Image node converts your image to linear space, applies this resampler, and converts back - so you get Lanczos behaving the way it does in GIMP or Photoshop, rather than the slightly murky result of applying a sinc kernel to gamma-encoded pixels. If you've ever compared a ComfyUI resize to a Photoshop resize and thought the Photoshop one looked "cleaner," this is that difference.

    How it works

    Lanczos is a windowed sinc filter: sinc(x) * window(x), applied as a separable 2D convolution. The single input, radius, controls how many lobes of the kernel get used:

    • radius 2 - two lobes. Fast-ish, mild ringing, still noticeably sharper than bilinear.
    • radius 3 (default) - three lobes. The standard, and the one to leave alone.
    • radius 4+ - four or more lobes. Slightly sharper, but you're buying ringing risk and speed for it. Almost never worth it.

    The node's output is a resampler wire - it doesn't produce an image. You plug that wire into Resample Image (for pixels), Resample Mask, or Resample Latent, and the filter becomes part of that resize.

    The inputs that matter

    Honestly, just the one: radius. Default 3, integer, min 1. Leave it at 3 unless you're chasing a specific look. One real downside to know about: Lanczos rings. On a hard-edged, high-contrast boundary you can get faint overshoot halos. That's inherent to the kernel, and it's why the pack also ships Resampler | Mitchell-Netravali (smoother, ring-free) and Resampler | Area (the right tool for heavy downscaling). For plain upscaling of a decent image, Lanczos is the one to reach for first.

    Installing

    It ships in comfyui-some-image-processing-stuff:

    cd ComfyUI/custom_nodes
    git clone https://github.com/wmpmiles/comfyui-some-image-processing-stuff
    

    Then restart ComfyUI. Or search "Some Image Processing Stuff" in ComfyUI Manager and install it there. No model downloads, no extra pip packages - the pack is pure PyTorch and runs as soon as it's cloned. The one thing beginners trip on is forgetting that a resampler node must be wired into a Resample node; the socket is required, so an empty one just errors.

    Categoryresampling

    Inputs (1)

    NameTypeDefaultDescription
    radiusINT3

    Outputs (1)

    NameTypeDescription
    resamplerRESAMPLER