Nodes/ComfyUI 1hewNodes/Image Resize Universal
ComfyUI Node

Image Resize Universal

The one resizer that doesn't care which model you're feeding

By 1hew·Created about a year ago·Updated 7 days ago· 33
Image Resize Universal
  • image
  • mask
  • get_image_size
  • image
  • mask
preset_ratioorigin
proportional_width1
proportional_height1
methodlanczos
scale_to_sideNone
scale_to_length1024
fitcrop
pad_color1.0
divisible_by8

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 (use proportional_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, or height to a length, or use length_to_sq_area. The classic combo is preset_ratio=origin, scale_to_side=longest, scale_to_length=1024.
  • fit - crop (keep aspect, center-crop to target), pad (keep aspect, center-pad), or stretch (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), or mirror (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 pad mode 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=crop centers on the image, not on your subject. If you're cropping to a subject, use the pack's Image Crop With BBox Mask instead, 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_length only applies when scale_to_side isn't None.

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.

Category1hewNodes/image/resize

Inputs (12)

NameTypeDefaultDescription
preset_ratioCOMBOorigin11 options: origin, custom, 1:1, 3:2, 4:3, 16:9, +5
proportional_widthINT11–8192
proportional_heightINT11–8192
methodCOMBOlanczos6 options: nearest, bilinear, lanczos, bicubic, hamming, box
scale_to_sideCOMBONone6 options: None, longest, shortest, width, height, length_to_sq_area
scale_to_lengthINT10241–8192
fitCOMBOcrop3 options: crop, pad, stretch
pad_colorSTRING1.0
divisible_byINT81–1024
imageoptIMAGE
maskoptMASK
get_image_sizeoptIMAGE

Outputs (2)

NameTypeDescription
imageIMAGE
maskMASK