Nodes/comfyui-art-venture/Scale Down To Size
ComfyUI Node Runs on cloud

Scale Down To Size

ImageScaleDownToSize — clamp an image's longest (or shortest) side to a pixel size

By sipherxyz·Created 3 years ago·Updated 4 months ago· 352
Scale Down To Size
  • images
  • IMAGE
size512
modetrue

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, default 512, range 18192.
  • mode - a boolean toggle that decides which side gets measured against size: 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 exceeds size), you clamp the longest side. If you want to guarantee the image covers a box (nothing is smaller than size, 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.

CategoryArtVenture/Utils

Inputs (3)

NameTypeDefaultDescription
imagesIMAGE
sizeINT5121–8192
modeBOOLEANtrue

Outputs (1)

NameTypeDescription
IMAGEIMAGE