🍒Image_Resize📐图像尺寸缩放
Image_Resize scales the long side to a clean 8-multiple, with an anti-alias trick
- image
- IMAGE
ComfyUI's stock resize node works, but it has a habit of handing back odd dimensions that then fight with latent-size requirements. Image_Resize from KimNodes is a friendlier take: give it a target size, and it scales your image so the long side lands on that value, rounded up to a multiple of 8 - the resolution sweet spot most diffusion pipelines want. Aspect ratio is preserved, no stretching.
It also carries a little anti-aliasing trick you don't see in every resize node: the supersample option. Turn it on and the image is first upscaled 8× and then downscaled to the final size. It's a cheap, well-known way to get smoother edges when downscaling - the same idea behind supersampling in game rendering, and exactly the "interpolation, not generation" philosophy the upscaling crowd keeps coming back to.
How it works
It takes image, target_size, supersample (true/false), and resampling (lanczos, nearest, bilinear, bicubic). The algorithm looks at the current width vs height: it scales the long side to target_size (rounded to the nearest multiple of 8), computes the other side proportionally, and does the same 8-multiple rounding there. Then it applies the chosen filter - LANCZOS is the default recommendation for quality, and if supersample is true it resizes to 8× first, then down to final with the same filter.
Output: a single IMAGE. One honest limitation: it processes the first frame of a batch and drops the rest. If you need to resize a whole batch, loop it or use a batch-capable resize node.
The inputs that matter
target_size- the desired long-side length (256–15360, step 4). Default 1024.resampling- filter choice. For downscaling with quality, keeplanczos;nearestis only for pixel-art where you want hard edges.supersample- on = 8×-then-down anti-alias pass; off = single pass. Costs a little time, buys cleaner edges.
Installation
Standard KimNodes pack install - Manager → search "ComfyUI_KimNodes" → Install → Restart, or git clone https://github.com/wjl0313/ComfyUI_KimNodes into custom_nodes. No extra dependencies (pure PIL + torch).
Common issues
- Wrong aspect / stretched output - shouldn't happen here; the node preserves aspect by design. If you see distortion, check what fed it - an unusual tensor layout (e.g. CHW) can confuse the width/height read.
- Batch only produces one resized image - the first-frame-only limitation. For full batches, use it per-frame or reach for a batch node.
- Odd-looking dimensions - it rounds to 8-multiples, which is usually a feature, but if you need exact dimensions for a strict controlnet alignment, the rounding can surprise you. Check the output size and account for it.
It's not a headline node, but it's a solid default resize - the kind that quietly prevents "why won't my KSampler accept this size" errors.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| supersample | COMBO | 2 options: true, false | |
| resampling | COMBO | 4 options: lanczos, nearest, bilinear, bicubic | |
| target_size | INT | 1024256–15360 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |