Resize Image ver KJ (UTK)
The KJ v2-style resize node that covers every fit mode, mask included
- image
- mask
- IMAGE
- width
- height
- mask
There's a resize node for every occasion, and then there's Resize Image ver KJ (UTK) - the one from ComfyUI-UniversalToolkit that tried to cover every occasion. It's explicitly modeled on kijai's KJNodes Image Resize v2 (the pack credits kijai's nodes as reference), and it bundles the full set of fit modes in a single dropdown. Stretch, resize, pad, pad_edge, pad_edge_pixel, crop, pillarbox_blur, total_pixels - plus crop_position, a divisible_by snap, and a mask that resizes in lockstep. If you've used KJNodes, you know exactly what this is; if you haven't, it's the most capable single resize node in this pack.
How it works
You give it a target width and height, then keep_proportion decides what "fitting" means:
resize- proportional scale only, no fill. Output may be smaller than the target on one axis. v1.4.7 made this distinction explicit after resize and pad were confusingly identical.pad/pad_edge/pad_edge_pixel- scale to fit, fill the rest withpad_color(default"0, 0, 0"= black).stretch- force exact dimensions, distortion allowed.crop- scale to cover and crop the overflow.pillarbox_blur- fill the leftover with a blurred, dimmed copy of the image. Cinema letterbox.total_pixels- interpret width×height as a total pixel budget and compute dimensions that preserve aspect ratio.
crop_position (a string: center/top/bottom/left/right) anchors both crop and pad placement. divisible_by (default 2) snaps the result to a multiple, which is how you keep latent-friendly sizes like 8 or 16 without thinking about it. upscale_method gives you the PyTorch sampler set - nearest-exact, bilinear, area, bicubic, lanczos - and there's a device toggle (cpu/gpu) for the torch ops.
The optional mask input is the standout for inpainting pipelines: the mask gets resized with the same fit logic, so a crop or pad on the image is mirrored exactly on the mask. No separate mask-resize node, no misalignment.
Inputs and outputs that matter
width/height- the target.keep_proportion- the fit mode; this is 90% of the node's personality.divisible_by- snap factor, default 2.mask- optional, resized in lockstep.
Outputs: IMAGE, width (actual), height (actual), and mask.
Install and gotchas
Install via ComfyUI Manager (search "ComfyUI-UniversalToolkit") or:
cd ComfyUI/custom_nodes
git clone https://github.com/whmc76/ComfyUI-UniversalToolkit
pip install -r requirements.txt
Restart ComfyUI. No models, no keys.
The gotchas are the same ones the pack's changelog had to fix, so you don't have to relive them: resize does not fill to the target - if you need exact output dimensions, use pad. And pad_color here is a free-text string ("0, 0, 0"), not the preset list the pack uses in its other resize nodes - a mismatch worth knowing before you type "black" and get a parse error. One more: this is interpolation, the "more pixels" job, not a detail-adding upscaler, so don't expect it to invent texture on a big upscale.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| width | INT | 5120–16384 | — |
| height | INT | 5120–16384 | — |
| upscale_method | COMBO | 5 options: nearest-exact, bilinear, area, bicubic, lanczos | |
| keep_proportion | COMBO | resize | 8 options: stretch, resize, pad, pad_edge, pad_edge_pixel, crop, +2 |
| pad_color | STRING | 0, 0, 0 | — |
| crop_position | STRING | center | — |
| divisible_by | INT | 20–512 | — |
| maskopt | MASK | — | |
| deviceopt | COMBO | cpu | 2 options: cpu, gpu |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| width | INT | — |
| height | INT | — |
| mask | MASK | — |