Nodes/wlsh_nodes/Image Scale by Shortside (WLSH)
ComfyUI Node

Image Scale by Shortside (WLSH)

Image Scale by Shortside (WLSH)

By wallish77·Created 3 years ago·Updated 2 years ago· 144
Image Scale by Shortside (WLSH)
  • original
  • IMAGE
  • width
  • height
upscale_method
shortside512

Instead of thinking in scale factors ("make it 2x bigger"), this node lets you think in target size ("I want the short edge to end up at 768px, whatever the long edge lands on"). Feed it a source image, tell it what you want the shorter side to become, and it resizes the whole thing proportionally to hit that - aspect ratio preserved, no cropping, no distortion.

That's a genuinely different mental model from most upscale nodes, and it's the more useful one for a specific, common situation: prepping an image for something that cares about the shortest dimension rather than total pixel count or a fixed factor. ControlNet preprocessors are the classic case - a lot of them want a specific minimum edge length to work well, and if your source images come in at wildly different aspect ratios (some near-square, some panoramic), a flat "2x everything" approach leaves you with inconsistent short-edge sizes across your batch. Pinning the short side to a fixed number normalizes that.

Note this is a plain interpolating resize, not a model-based upscale - no ESRGAN, no generative detail invention. If your source is already sharp and you just need it a specific size, that's exactly the right tool and it's essentially free. If your source is small or soft and you actually need more detail, not just more pixels, this isn't that job - pair it with (or swap it for) an upscale-model node or a generative upscaler afterward.

Inputs: original is your source IMAGE. upscale_method picks the interpolation algorithm - nearest-exact (blocky, preserves hard edges, good for pixel art or masks), bilinear (smooth, the safe default for photos), or area (good when you're shrinking rather than enlarging, since it averages pixels instead of just sampling). shortside is the target length for the shorter edge, 32 to 4096 in steps of 32, default 512.

Outputs, three of them: IMAGE is your resized result. width and height come back as plain INTs too - genuinely handy, since it saves you from adding a separate "get image size" node when something downstream (a filename, an SDXL micro-conditioning field, a crop calculation) needs the actual pixel dimensions as numbers rather than just the resized image itself.

Installing it: through ComfyUI Manager, search "wlsh_nodes"; or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/wallish77/wlsh_nodes

Restart ComfyUI. No model files or extra dependencies needed - this is a pure resize operation.

Where it can surprise you: because the target is the shorter side, a landscape and a portrait image with the same shortside value will end up as different overall sizes on the long edge - which is the entire point, but it's worth remembering if you're expecting every output in a batch to come out the same total resolution. They won't; they'll all share the same short-edge length and differ on the long edge according to their original aspect ratio. If you need every output at one fixed resolution regardless of source aspect ratio, you want a crop-and-resize approach instead, not this node.

CategoryWLSH Nodes/upscaling

Inputs (3)

NameTypeDefaultDescription
originalIMAGE
upscale_methodCOMBO3 options: nearest-exact, bilinear, area
shortsideINT51232–4096

Outputs (3)

NameTypeDescription
IMAGEIMAGE
widthINT
heightINT