ComfyUI Node

Resample Image

Resize an image properly, without the gamma smear

By wmpmiles·Created 2 years ago·Updated about a year ago· 5
Resample Image
  • image
  • scaler
  • resampler
  • image

Resample Image is the workhorse of this pack: it takes an image, resizes it with a proper resampling filter, and hands you back a bigger or smaller image. It's the node you reach for when you want more pixels (or fewer), not more invented detail - the "more pixels, source already sharp" job that the upscaling essay calls Lanczos territory. This node doesn't add hallucinated detail, which is the whole point.

The twist that makes it worth using over ComfyUI's built-in resize: it resamples in linear-light sRGB. Your image arrives in gamma-encoded space, the node converts it to linear, resamples there, then converts back. Why bother? Resampling in gamma space smears dark tones and makes downscaled images look muddy. GIMP and Photoshop resample in linear space; most naive torch.nn.functional.interpolate calls don't. That's the difference you can see at the edge of a high-contrast object.

How it works

Resample Image doesn't have a "width" and "height" input. Instead it takes three sockets:

  • image - the IMAGE you're resizing.
  • scaler - a SCALER wire that decides the output size from the current size.
  • resampler - a RESAMPLER wire that decides the method (nearest, Lanczos, triangle, area, etc).

Both the scaler and resampler come from their own little parameter nodes, and they pass actual functions down the wire. This is the pack's whole architecture: pick a Scaler | Fixed (set 1024×1024) and a Resampler | Lanczos, wire them in, and the output is deterministic given your inputs. The two concepts are deliberately separated, so you can swap the size strategy without touching the filter and vice versa.

The inputs that matter

You don't set much on this node itself - the three inputs are the image, the scaler, and the resampler, and the output is a single image. The real controls live on the scaler and resampler nodes you wire in, so the practical workflow is:

  1. Pick a scaler. Scaler | Fixed for a hard target resolution, Scaler | Area to scale by total pixel count, Scaler | Megapixels to land on a target area.
  2. Pick a resampler. Resampler | Lanczos for sharp quality, Resampler | Area when you're shrinking a lot and want to avoid aliasing.
  3. Run it.

Installing

The whole pack comes from one repo, so install once and you get every node in this family:

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

Then restart ComfyUI. Or use ComfyUI Manager - search "Some Image Processing Stuff" in the Custom Nodes Manager and hit install. There are no extra dependencies beyond PyTorch (the pack's own pyproject.toml declares an empty dependency list), and there are no model files to download. That's rarer than it should be in this ecosystem, and it means installs are instant.

Where people get burned

The classic mistake is leaving the scaler or resampler socket empty. ComfyUI shows the node with three inputs and it's easy to assume the defaults will do something - they won't; the node errors with a missing required input. The other trap: Scaler | Fixed doesn't preserve aspect ratio, so a wide image squashed to 1024×1024 comes out distorted. If you want a fixed size without distortion, use Scaler | Area or Scaler | Megapixels instead. None of this is the node being broken - it's just that the size math lives a node away.

Categoryimage

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
scalerSCALER
resamplerRESAMPLER

Outputs (1)

NameTypeDescription
imageIMAGE