NodeImageResize
Resize by short side, not by fiddling two boxes
- image
- image_resize
- width
- height
Core ComfyUI resizes images by letting you type a width and a height, then distorts or letterboxes to fit. That's backwards for a lot of real work: you usually care about one number - "make the short side ~1024" - and want the other dimension to follow so nothing stretches. NodeImageResize is a one-knob version: give it a target for the short side, it preserves the aspect ratio, and it guarantees both final dimensions land on multiples of 16. It's one of the three nodes in KERRY-YUAN's tiny ComfyUI_Simple_Executor pack, and for a node with six Google impressions, it's genuinely handy.
How it works
The mechanism is small enough to read in one sitting. It takes your shortside (clamped to 560–9600 and rounded to a multiple of 16), computes scale = target / min(w, h), and resizes the image with Lanczos. Because the target itself is a multiple of 16 and the short side maps exactly onto it, the short dimension always lands on the 16 grid, and the long side gets rounded up to the nearest multiple of 16. So an 800×600 image with shortside 768 comes out 1024×768, per the author's example - both sides clean multiples.
Inputs and outputs
Inputs are just image (IMAGE) and shortside (INT, default 1024). Outputs:
image_resize(IMAGE) - the resized tensor, ready to wire into a VAE encode, ControlNet prep, or img2img path.width(INT),height(INT) - the actual final dimensions, both multiples of 16.
Those two ints are the sleeper feature. Wire them into anything that needs to know the size (a latent upscale target, an empty latent node, a text display) and you never hardcode a dimension again.
Why the 16-multiple matters
It's not pedantry. The VAE downsamples into latent space by 8×, and generation models - SDXL especially - were trained on specific aspect ratios and clean grids. Odd dimensions mean ragged latent tiles, potential cropping, and decode artifacts; a 16 grid keeps latents whole and matches the SDXL multi-aspect ratio family (1152×896, 1216×832, and friends). If you've ever fed an odd-sized image into a sampler and gotten a subtly wrong result, this is the class of bug you're dodging.
Honest verdict
This is a 30-line convenience node - you can rebuild it with an ImageScale plus a math node or two, but then you're maintaining the rounding logic yourself. Where it earns its keep: img2img prep, feeding a fixed-size latent for inpainting, or normalizing a mixed batch of input images to one consistent short side before anything else touches them.
Two real limitations worth knowing before you reach for it. First, the resize code only processes the first frame of a batch (the source reads image[0]), so don't feed it video frames or a multi-image batch expecting all of them back. Second, there's no mask handling - if your workflow resizes a mask alongside the image, that's what NodeImagePre, its sibling in the same pack, is for.
Install
Same pack as everything else in NodeSimpleExecutor - ComfyUI Manager (search ComfyUI_Simple_Executor), or:
cd ComfyUI/custom_nodes
git clone https://github.com/KERRY-YUAN/ComfyUI_Simple_Executor
Then restart. No extra Python dependencies (torch/numpy/Pillow are already in ComfyUI) and no model files to hunt down. If you already resize by short side by hand every time, this saves you a math node - and if you don't, it's a painless way to start.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| shortside | INT | 1024560–9600 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image_resize | IMAGE | — |
| width | INT | — |
| height | INT | — |