Image Resize Universal
The one resizer that doesn't care which model you're feeding
- image
- mask
- get_image_size
- image
- mask
Every diffusion model has opinions about input resolution, and none of them agree. One wants 1024×1024, one wants a 3:2 crop, one insists dimensions are multiples of 8, another wants 16. Image Resize Universal is the pack's general-purpose answer: one node that handles ratio, target side, resampling method, fit strategy, and model-alignment constraints - and it resizes your mask in sync the whole way, so image and mask never drift apart.
Where the pack's FluxKontext and QwenImage resizers are preset-specific (they snap to one model's fixed resolution buckets), this one is the generalist. Reach for it when you're not targeting a specific model's presets, or when you want explicit control over the output size.
How it works
It builds a target size from a few cooperating inputs, then applies a fit strategy:
- preset_ratio -
origin(keep input),custom(useproportional_width/proportional_height, e.g. 4:3), or a standard ratio list (1:1,16:9,21:9, etc.). - scale_to_side + scale_to_length - the "how big" control: lock the
longest,shortest,width, orheightto a length, or uselength_to_sq_area. The classic combo ispreset_ratio=origin,scale_to_side=longest,scale_to_length=1024. - fit -
crop(keep aspect, center-crop to target),pad(keep aspect, center-pad), orstretch(distort to fit). - method -
lanczos(default),bicubic,bilinear,nearest,hamming,box. - divisible_by - rounds output dimensions up to a multiple (default 8; models love this).
- pad_color - for pad mode: color,
edge,average,extend(replicate), ormirror(reflect).
The mask rules are the subtle part, and they're genuinely smart. In pad mode the output mask marks the original content white and the padding black - so it doubles as a "where is the real image" region map for later compositing. In crop mode the mask expresses the cropped region. In stretch mode it's fully white. Feed a get_image_size reference image, or even no image at all, and it still produces a sensible sized output.
Install
Part of ComfyUI-1hewNodes:
cd ComfyUI/custom_nodes
git clone https://github.com/1hew/ComfyUI-1hewNodes
Restart ComfyUI. No models, no downloads. The pack needs a current ComfyUI (v3 node API).
Where it fits
The job it's best at: aligning random inputs to whatever your current pipeline demands, mask included. Load a folder of mixed-resolution images, feed them through with fit=pad and divisible_by=8, and they all come out the same size with synchronized masks - ready for a batch, an upscaler, or a video encoder.
Common issues
- The mask isn't a copy of the image - in
padmode the mask is a region map (white = content, black = padding), not a resized copy of your input mask. That surprises people who expected a dumb resize. It's the feature, not a bug. - Crops cut off your subject -
fit=cropcenters on the image, not on your subject. If you're cropping to a subject, use the pack'sImage Crop With BBox Maskinstead, which centers on a mask. - Unexpected size - check
divisible_by; output rounds up to the multiple, so 1001px becomes 1008. And if nothing else explains it,scale_to_lengthonly applies whenscale_to_sideisn'tNone.
If you only remember one thing: default preset_ratio=origin + scale_to_side is the combination that "resize to fit" workflows actually want, and it's not what the default panel shows. Set it once, save the workflow.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| preset_ratio | COMBO | origin | 11 options: origin, custom, 1:1, 3:2, 4:3, 16:9, +5 |
| proportional_width | INT | 11–8192 | — |
| proportional_height | INT | 11–8192 | — |
| method | COMBO | lanczos | 6 options: nearest, bilinear, lanczos, bicubic, hamming, box |
| scale_to_side | COMBO | None | 6 options: None, longest, shortest, width, height, length_to_sq_area |
| scale_to_length | INT | 10241–8192 | — |
| fit | COMBO | crop | 3 options: crop, pad, stretch |
| pad_color | STRING | 1.0 | — |
| divisible_by | INT | 81–1024 | — |
| imageopt | IMAGE | — | |
| maskopt | MASK | — | |
| get_image_sizeopt | IMAGE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |