Image Scale By Short Side Target @zn123
The tiered scaler that thinks in target sizes, not multipliers
- image
- scaled_image
- width
- height
- scale_factor
- scale_info
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 equalstarget_size1 - between
threshold1andthreshold2→ short side becomestarget_size2 - at or above
threshold2→ short side becomestarget_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 insteadupscale_method- the usual five (defaultbicubic)
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
threshold2must stay abovethreshold1. 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_upscaleis 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.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| upscale_method | COMBO | bicubic | 5 options: nearest, bilinear, bicubic, area, lanczos |
| target_size1 | INT | 204864–8192 | — |
| threshold1 | INT | 51264–2048 | — |
| target_size2 | INT | 102464–8192 | — |
| threshold2 | INT | 102464–4096 | — |
| target_size3 | INT | 102464–8192 | — |
| only_upscale | BOOLEAN | true | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| scaled_image | IMAGE | — |
| width | INT | — |
| height | INT | — |
| scale_factor | FLOAT | — |
| scale_info | STRING | — |