Nodes/ComfyUI 1hewNodes/Image Resize QwenImage
ComfyUI Node

Image Resize QwenImage

Snap your input to QwenImage's exact resolution buckets

By 1hew·Created about a year ago·Updated 8 days ago· 33
Image Resize QwenImage
  • image
  • mask
  • image
  • mask
preset_sizeauto
fitcrop
pad_color1.0

QwenImage - Alibaba's Apache-2.0 image family, and its Edit line in particular - has a fixed set of native resolutions it's happy with. Feed it a random 1287×943 and it'll work, but it works better when the input lands on one of its intended buckets. Image Resize QwenImage exists to make that trivial: it resizes your image (and mask, in sync) to one of seven QwenImage presets, or picks the closest one automatically.

If you're running Qwen-Image or Qwen-Image-Edit workflows - and a lot of people are, since the Edit line became the default open instruction-editor after Flux Kontext's license clampdown - this is the "get my image into the right shape" node.

How it works

The presets are the model's resolution ladder: 1328×1328 (1:1), 1056×1584 (2:3) and 1584×1056 (3:2), 928×1664 and 1664×928 (portrait/landscape), plus two intermediate ratios. The auto preset compares your input's aspect ratio to all seven and picks the nearest - so a landscape shot lands on 1584×1056, a square on 1328×1328.

Then fit decides how to reach the target:

  • crop - keep aspect, center-crop to the bucket. No dead space, but edges get cut.
  • pad - keep aspect, center-pad; pad_color fills the bars, with smart strategies (edge, average, extend, mirror) that make padding look intentional rather than like a white frame.
  • stretch - direct resize, distorts the image.

The mask output stays synchronized throughout: in crop mode the mask marks the cropped region, in pad mode it marks content-vs-padding (white = real content, black = bars), in stretch mode it's full white. That sync is the pack's signature and it's why you can safely run image+mask through these resizers without losing alignment.

Install

It's in ComfyUI-1hewNodes:

cd ComfyUI/custom_nodes
git clone https://github.com/1hew/ComfyUI-1hewNodes

Restart ComfyUI. No models, no downloads - this is resize math, not AI. Current ComfyUI expected (v3 node API).

Where it fits

Straightforward: in front of a Qwen-Image or Qwen-Image-Edit conditioning stack. Get your reference image and any mask onto a preset, feed them in, done. If you're editing with Qwen-Image-Edit, getting the reference to the native bucket matters more than it does for a plain text-to-image run - the model is comparing pixels.

Common issues

  • auto picks by aspect ratio only, not size - a 4000×4000 image with auto lands on 1328×1328. If you want the long side to stay 2000px, this node isn't the tool; use the pack's Image Resize Universal with scale_to_side instead.
  • Only a mask connected - fine, it resizes the mask and generates a solid-color image using pad_color. That's intended, not an error.
  • Thinking this is Qwen-Image-2.0 compatible sizing - the presets here match the open 20B family's buckets; Qwen-Image-2.0 is a different 7B generation that's been API-first, so don't assume the same ladders. Match presets to the weights you actually loaded.

It's a narrow tool with a narrow job, and it does that job cleanly. If you use QwenImage at all, it'll save you the recurring "what resolution does it want again?" lookup.

Category1hewNodes/image/resize

Inputs (5)

NameTypeDefaultDescription
preset_sizeCOMBOauto8 options: auto, 928×1664 [1:1.79], 1056×1584 [1:1.50] (2:3), 1140×1472 [1:1.29], 1328×1328 [1:1.00] (1:1), 1472×1140 [1.29:1], +2
fitCOMBOcrop3 options: crop, pad, stretch
pad_colorSTRING1.0
imageoptIMAGE
maskoptMASK

Outputs (2)

NameTypeDescription
imageIMAGE
maskMASK