Scale Down To Size
ImageScaleDownToSize — clamp an image's longest (or shortest) side to a pixel size
- images
- IMAGE
This is the "make sure this image isn't bigger than X on one side" node. You give it a pixel size, it scales the image down so that one of its dimensions hits that number, and it keeps the aspect ratio intact. Downscale only - it won't blow small images up. Think of it as a safety clamp you drop in front of anything that misbehaves on huge inputs.
Where it earns its keep: a user (or an earlier node, or a URL loader) hands your workflow a 4000px monster, and the next step - a captioner, a ControlNet preprocessor, a VAE encode - either chokes on it or wastes time. Clamp the longest side to 1024 first and everything downstream behaves. It's unglamorous plumbing, but plumbing you'll reach for constantly once you're building workflows that take arbitrary inputs.
How it works
Nothing fancy - it computes the scale factor needed to bring the chosen dimension down to size, applies it to both width and height so the proportions hold, and resamples. Because it only ever shrinks, there's no detail-invention question here; downscaling throws pixels away cleanly, which is exactly what you want.
The inputs and outputs that matter
images- the image or batch to clamp.size- the target pixel length for the side it's measuring, default512, range1–8192.mode- a boolean toggle that decides which side gets measured againstsize: the longest side or the shortest. This is the one people trip on. If you want to guarantee an image fits inside a box (nothing exceedssize), you clamp the longest side. If you want to guarantee the image covers a box (nothing is smaller thansize, e.g. before a center crop), you clamp the shortest side. Flip the toggle and watch the output dimensions to confirm you got the one you meant.
Output is a single IMAGE at the reduced size.
How to install it
Ships with the Art Venture pack. ComfyUI Manager → search comfyui-art-venture → Install → restart. Or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/sipherxyz/comfyui-art-venture
then pip install -r comfyui-art-venture/requirements.txt and restart. No model needed - it's a resize.
Common issues & troubleshooting
My small image didn't get bigger. By design. This node only scales down. If the input is already smaller than size on the measured side, it passes through untouched. Need to enlarge? That's a different job - ImageScaleToMegapixels with an upscale model, or a dedicated upscaler.
Wrong dimension got clamped. That's the mode toggle doing the opposite of what you assumed. There's no universal convention for which boolean state means "longest" - the reliable move is to run it once and read the output size, then set the toggle to match your intent. Two-second check, saves a confused debugging session.
It's still too heavy for the next node. Remember size clamps one side, so a very wide panorama clamped by its longest side can still be short-but-huge in area. If area is what's hurting you (VRAM on a VAE encode, say), reach for ImageScaleToMegapixels instead - that clamps total pixels, which is usually the real constraint.
Missing node after a workflow import. The pack isn't installed. Manager → Install Missing Custom Nodes pulls it in.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| size | INT | 5121–8192 | — |
| mode | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |