ComfyUI Node

Resample Latent

Resize a latent with an actual filter, not a crude nearest-neighbor

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

Resample Latent resizes a latent directly, applying your chosen resampler to the latent tensor instead of to pixels. It takes latent, scaler, and resampler, and outputs a latent. It's the most specialized of the three Resample nodes, and it deserves a "do you actually need this?" paragraph up front.

Here's the thing. Latents aren't images - they're a compressed representation of image information, typically 8× smaller per side than the pixels they describe (the VAE downsamples in stages, which is why latent resolutions in ComfyUI tend to come in multiples of 8). ComfyUI's built-in latent upscaling nodes interpolate latents with a fixed method, and in most normal workflows - hi-res fix, detail pass - the standard nodes are the right tool. So when would you want this one instead?

Why this node exists

Two honest use cases. First, you're building a pipeline where you want the same filter choice applied consistently across image, mask, and latent - the pack's resampling architecture is designed so the resampler and scaler you pick are shared objects, and Resample Latent completes that trio. Wire one Resampler | Lanczos into all three Resample nodes and your whole chain uses the same filter.

Second, you specifically want more control than the built-in latent resize gives you. ComfyUI's default latent upscale uses a basic area/nearest path depending on the method, which is fine but crude. This node runs the full filter set - Lanczos, Jinc-Lanczos, Mitchell-Netravali, triangle - over the latent's 2D spatial axes. Whether that visibly matters is model-dependent and hard to eyeball from latent space; on SDXL it's subtle. Treat it as a nice knob, not a magic quality switch.

The inputs that matter

  • latent - the LATENT dict from a VAE-encode or sampler. The node resamples its samples tensor along the spatial dims and copies the rest of the latent dict, so masks and other metadata in the latent survive.
  • scaler - decides the target size. Scaler | Fixed is the usual pick for a hi-res pass; remember it doesn't preserve aspect ratio.
  • resampler - the filter. Lanczos or Mitchell-Netravali if you want quality, nearest if you're matching a hard-edge workflow.

Output is a single latent, ready to feed a KSampler or a detail pass.

What to watch out for

If you're resampling a latent as part of upscaling, keep the same VAE in the loop - the concepts essay's point about shared latent spaces applies: decode and re-encode with a different VAE and you're paying a lossy round trip for nothing. Also, don't confuse latent resolution with pixel resolution: setting Scaler | Fixed to 2048 here produces a latent of 2048×2048, which decodes to something much larger (and may be more than your sampler expects). Match the latent size to what your model was trained on, then let the pixel-side resampling handle the rest.

Installing

Same pack as everything else here - comfyui-some-image-processing-stuff:

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

Restart ComfyUI, or use ComfyUI Manager → search "Some Image Processing Stuff". No pip dependencies beyond PyTorch, no model files.

Categorylatent

Inputs (3)

NameTypeDefaultDescription
latentLATENT
scalerSCALER
resamplerRESAMPLER

Outputs (1)

NameTypeDescription
latentLATENT