Nodes/ComfyUI-image-processor-zn123/Image Scale By Short Side Target @zn123
ComfyUI Node

Image Scale By Short Side Target @zn123

The tiered scaler that thinks in target sizes, not multipliers

By zn123·Created 9 months ago·Updated 5 months ago· 0
Image Scale By Short Side Target @zn123
  • image
  • scaled_image
  • width
  • height
  • scale_factor
  • scale_info
upscale_methodbicubic
target_size12048
threshold1512
target_size21024
threshold21024
target_size31024
only_upscaletrue

Its sibling ImageScaleByShortSideFactor asks you to think in multipliers ("small gets 4x"). Image Scale By Short Side Target @zn123 asks the same question a better way: how big should the short side end up in each size band? Same tiered idea, but you configure destination sizes instead of scale factors - which, let's be honest, is how most people actually think about preprocessing.

The mechanism

Like its sibling, it measures the short side and picks one of three outcomes. But instead of multipliers, each band sets a target short-side length:

  • short side below threshold1 → scale up until the short side equals target_size1
  • between threshold1 and threshold2 → short side becomes target_size2
  • at or above threshold2 → short side becomes target_size3

The defaults are a sensible read of the intent: short side under 512 → 2048 target, 512–1024 → 1024, over 1024 → 1024 (which, combined with only_upscale, effectively means "already big enough, leave it alone"). So a 320px thumbnail gets pushed to a solid 2048 on its short edge, a 768px image lands at 1024, and anything past 1024 passes through untouched. One node, and a mixed bag of inputs comes out normalized without a single condition node.

The inputs you'll actually touch:

  • target_size1 / target_size2 / target_size3 - INTs, the destination short-side lengths per band (defaults 2048 / 1024 / 1024)
  • threshold1 / threshold2 - INTs, the band boundaries (defaults 512 / 1024)
  • only_upscale - BOOLEAN, default true: if a band would shrink the image, it's skipped instead
  • upscale_method - the usual five (default bicubic)

Outputs: scaled_image (IMAGE), width and height (INT), scale_factor (FLOAT - the multiplier actually applied, which is useful feedback), and scale_info (STRING - a summary like Original: 400×300, Short side: 300px, Scale: 6.83x, Target short side: 2048px, New: 2731×2048, short side < 512px). As with the factor version, it's marked an output node, so that text shows up in ComfyUI's output area when it runs. For a batch preprocessor that's the difference between guessing and knowing what happened to each image.

When you'd prefer this over the factor version

If your goal is "everything ends up above a usable resolution," the target version is the more honest tool: you say where you want the short edge to land and it computes whatever factor that requires. The factor version makes you do that division in your head per band. For most preprocessing - feeding references to ControlNet, IPAdapter, or a hi-res second pass - targets beat multipliers. The factor node is the right pick when you genuinely want a fixed ratio per tier (say, pixel-art doubling).

Installing it

Standard pack install:

  • ComfyUI Manager - search "ComfyUI-image-processor-zn123", install, restart.
  • Manual - from ComfyUI/custom_nodes:
cd ComfyUI/custom_nodes
git clone https://github.com/zn123/ComfyUI-image-processor-zn123

Restart, it's under image/processor. No model files, no heavy dependencies - torch/numpy/Pillow only, all already present.

Gotchas

  • threshold2 must stay above threshold1. The bands fire in order, so a flipped or equal pair silently kills the middle tier. The node won't complain; your 600px images just won't get their intended treatment.
  • Targets can overshoot in practice. A 300px short side targeting 2048 means a ~6.8x scale - huge, memory-hungry output from a tiny source. This is interpolation, not restoration; if the source is soft, no target size will conjure the detail that was never there.
  • only_upscale is on by default, so the "above 1024" band passes through rather than shrinking. If you want it to actually normalize oversized inputs down, flip it off.

Pick your targets, drop it in, watch the summary. The tiered pair are the two nodes in this pack genuinely worth installing for.

Categoryimage/processor

Inputs (8)

NameTypeDefaultDescription
imageIMAGE
upscale_methodCOMBObicubic5 options: nearest, bilinear, bicubic, area, lanczos
target_size1INT204864–8192
threshold1INT51264–2048
target_size2INT102464–8192
threshold2INT102464–4096
target_size3INT102464–8192
only_upscaleBOOLEANtrue

Outputs (5)

NameTypeDescription
scaled_imageIMAGE
widthINT
heightINT
scale_factorFLOAT
scale_infoSTRING