Image Resize Fit
Resize to a Set Short Edge — Read This Before Assuming It's 'Fit Within'
- image
- IMAGE
An aspect-ratio-preserving resize node sounds like the most boring thing in the world, so let's cut to the behavior nobody expects: size pins the shorter edge, not the longer one. Feed a 2:1 image with size = 512 and you get a 1024×512 output, not a 512×256. If you assumed "fit within size," this node just made your image bigger on the long side.
Once you know that, it's a tidy, useful utility - it's just that the name lies to you in the same direction as every other resize node in the ecosystem.
How it works
- image in, plus an optional size (default 512).
- It compares the image's width and height. If wider than tall, it sets the height to
sizeand scales the width by the aspect ratio; if taller, it sets the width tosizeand scales the height.
In code terms: for a wide image, new_width = size × (width/height), new_height = size. So size is always the length of the short edge, and the long edge follows the ratio - potentially way past size for a panorama. A 4000×1000 panorama at size=512 becomes a 2048×512 image. That's not "fit," that's "normalize the short side."
The reason this is a deliberate pattern rather than an accident: it's built for face-crop and img2img pipelines where you want every image to have the same short dimension so downstream nodes (like the off-suite face-crop family, or a VAE encode) see consistent geometry. It's also how you'd prep crops so that a detail pass always operates at the same scale.
When you'd use it
- Prepping crops before a detailer or inpaint pass, so each face crop has a consistent short edge.
- Normalizing a batch of mixed-aspect images before nodes that want matching dimensions (keep an eye on the long edge, since that's the one that varies).
- As a companion to Image Crop Fit: crop to square, then resize to a target short edge.
The gotcha, again
Two behaviors will surprise you, both from the same line of code. First, the short-edge semantics - a 2:1 image at size=512 comes out 1024×512, which can silently exceed VRAM-friendly dimensions if you weren't watching. Second, the resize is a plain PIL resize with default interpolation: fine for pipeline prep, not ideal if this is your final output and you care about sharpness. If you want "longest side = N," this isn't the node; you want a different resize utility.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/Off-Live/ComfyUI-off-suite
# or: ComfyUI Manager → search "ComfyUI-off-suite"
No dependencies, no models. It's a few lines in the pack's image_tool.py, sitting quietly in the OFF menu next to the rest of the face-crop helpers. The repo's been quiet since mid-2024, but a resize node doesn't really age.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| sizeopt | INT | 512 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |