Resize By Shorter Edge (CCN)
Consistent sizes without cropping your ratio
- images
- images
The core "Resize by W/H" nodes in ComfyUI force you to state both dimensions, which silently distorts anything that isn't exactly that aspect ratio. Resize By Shorter Edge (CCN) takes the other approach: you name one number, and it scales the image so the shorter edge lands on that number while the longer edge follows proportionally. Aspect ratio preserved, no stretching, done.
Set target_size to 1080 and a portrait 3:4 image and a landscape 16:9 image both come out with their short side at 1080 - which is exactly what you want when feeding mixed-source images into a consistent pipeline, whether that's a ControlNet pass, an IP-Adapter, or a batch of frames for a video model.
How it works
Three inputs:
- images - an IMAGE tensor. Handles batches, single images, and it's robust about formats: uint8 gets converted to float32 internally, and it can cope with tensor layouts that aren't the standard B,H,W,C (it'll warn and reshape if the height looks wrong).
- target_size - the short-edge target, default 1080, range 64–8192, stepped by 8.
- interpolation - bilinear (default), bicubic, nearest, or area.
Two implementation details worth knowing. First, the output dimensions are rounded down to multiples of 8 - a deliberate choice so your latent stays in the sizes the VAE handles cleanly, but it means the long edge won't be exactly proportional. Second, area interpolation only works for downscaling, so if you're upscaling with area selected it silently falls back to bilinear rather than erroring.
Install
Part of ComfyCollectorNodes, one install:
cd ComfyUI/custom_nodes
git clone https://github.com/valkymaera/ComfyCollectorNodes
then restart, or install via ComfyUI Manager ("ComfyCollectorNodes"). No models, no extra deps.
Where people get burned
It prints to the console on every run - input shape, dtype, the "Resizing" line. That's the author's debugging habit leaking into production; it's harmless but noisy, so don't be alarmed by the wall of [CCN Resize] lines in your terminal. And because dimensions are snapped to /8, don't assume the long edge equals exactly target_size × ratio - check the output shape once and then stop caring. For reference-driven sizing - "make this exactly the same size as that other image" - you want Resize To Match instead.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| target_size | INT | 108064–8192 | — |
| interpolation | COMBO | bilinear | 4 options: bilinear, bicubic, nearest, area |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |