TS Image Resize
The resize node that finally covers every mode you actually use
- pixels
- mask
- IMAGE
- width
- height
- MASK
Resizing is the boring work every workflow does twice before lunch: shrink the reference so it fits the model's native resolution, scale the output up to the size you want, match a video frame. Stock ComfyUI makes you pick a resize node, then wire width and height as separate numbers and hope the aspect ratio doesn't come out wrong. TS Image Resize bundles every common mode into one node and gives you an output that tells you what it actually did.
The README calls it "the resize node you actually want", and that's about right - it's the one I reach for when a workflow arrives and I don't want to think about interpolation math.
How it works
You pick exactly one mode by setting its value above 0; the rest stay off:
- Exact size -
target_width×target_height. Withkeep_proportionon (default) it cover-crops to fill while holding aspect; with it off it distorts to the exact size. - One side -
smaller_sideorlarger_sidesets just that side and derives the other. This is the one for "shrink every batch photo to max 1024 px". - Scale factor - multiply both dimensions by a float.
- Megapixels -
megapixelstargets a total pixel budget (used only when no other mode is set). Great for "I want about a 1MP image" without caring which dimension wins.
Two guards make it forgiving: divisible_by snaps the final dimensions to a multiple (set 8 or 16 or 32 for samplers that care), and dont_enlarge blocks any upscale when the source is already smaller than the target - no more accidentally doubling a 512 px icon to 2048.
There's also an optional mask input that resizes together with the image, which saves you from forgetting to resize the mask and getting an inpainting region that's offset by exactly your downscale factor.
Inputs and outputs that matter
The required input is pixels (the image). Everything else is a mode selector or guard, so the honest shortlist is: pick smaller_side/larger_side for batch work, target_width/target_height when you know the destination, and divisible_by whenever the result feeds a sampler.
Outputs: IMAGE (resized), width and height as ints (handy for downstream routing logic like "now that it's 896 wide, use this branch"), and MASK (resized, or passthrough when nothing was connected).
Installation
This node ships in the comfyui-timesaver pack. ComfyUI Manager: search "Timesaver", install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/AlexYez/comfyui-timesaver
cd comfyui-timesaver
python -m pip install -r requirements.txt
Restart ComfyUI after. It's under TS/Image/Size in the right-click menu.
Where people get tripped up
- Two modes set at once: only the first non-zero one wins, so zero the ones you're not using or you'll wonder why
scale_factoris being ignored. divisible_byand aspect ratio: snapping can drift the ratio a hair off. That's usually fine for latent input - samplers expect it - but don't use it when you need pixel-exact crops.keep_proportionsemantics: with both target dimensions set and the flag on, it crops to fill, not letterboxes. If you wanted letterboxing you're looking at a different tool.
It's a genuinely handy node - and the dont_enlarge guard alone is worth the install if you batch-resize mixed-size collections.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| pixels | IMAGE | Image to resize. | |
| target_width | INT | 00–8192 | Exact target width in pixels. 0 = ignore this mode. |
| target_height | INT | 00–8192 | Exact target height in pixels. 0 = ignore this mode. |
| smaller_side | INT | 00–8192 | Resize so the shorter side equals this length in pixels. 0 = off. |
| larger_side | INT | 00–8192 | Resize so the longer side equals this length in pixels. 0 = off. |
| scale_factor | FLOAT | 0.00–10 | Multiply both dimensions by this factor. 0 = off. |
| keep_proportion | BOOLEAN | true | Keep aspect ratio. With both target_width and target_height set, cover-crops to fill; off distorts to the exact size. |
| upscale_method | COMBO | bicubic | Interpolation method used for resizing. |
| divisible_by | INT | 11–256 | Round the final width and height to a multiple of this value. |
| megapixels | FLOAT | 1.000–256 | Target total pixel count in megapixels. Used only when no other size mode is set. |
| dont_enlarge | BOOLEAN | false | Never upscale above the original size. |
| maskopt | MASK | Optional mask resized together with the image. |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | Resized image. |
| width | INT | Final output width in pixels. |
| height | INT | Final output height in pixels. |
| MASK | MASK | Resized mask (passthrough when no mask is connected). |