QwenImageEditScale
The fiddly scaler that stops Qwen edits from drifting
- image
- IMAGE
- width
- height
- ratio
Qwen-Image-Edit is a picky eater. It's a 20B editor whose training data clusters around 1024×1024, and the moment you hand it a random-sized photo the geometry goes sideways: characters come back stretched, proportions skew, and things drift from where they started - the "offset" complaint that followed the model around in late 2025. QwenImageEditScale is the advanced control panel for feeding it food it recognizes.
It's the fiddly big sibling of QwenImageEditSimpleScale. SimpleScale does the one obvious thing - push the image to about a megapixel on a 32-pixel grid - and for most people that's the right node. This one exists for when you need to control the details: force a specific aspect ratio, choose the pixel budget, pick the resampler, and get the actual dimensions back as numbers instead of eyeballing them.
How it works
Three jobs, in order: pick a ratio, crop, scale. ratio_strategy drives the first two. closest (the default) matches your image to the nearest of the model's official allowed ratios - 1:1, 2:3, 3:4, 4:3, 9:16, 16:9, 1:3, 3:1 and their flips - then center-crops to it. disabled skips the crop entirely and just scales, keeping every pixel you captured. Or type an explicit W:H to force a frame, which is handy for a 9:16 character sheet or a fixed 16:9 export.
Then it scales: it computes a factor so total pixels land near target_megapixels (default 1.0, i.e. about 1M pixels - the model's happy zone), clamps the result into the 0.3–1.4 MP safe band the author hardcoded, and rounds both dimensions to alignment (default 32, matching the model's training grid). upscale_method picks the resampler; area is the default and is usually right for shrinking, lanczos when the change is small.
Inputs and outputs
Only three inputs really matter for a beginner: image, ratio_strategy, and target_megapixels. The optional alignment and upscale_method are fine at their defaults until you have a reason. Outputs: the resized IMAGE, plus width, height (both INT) and ratio (a STRING like "16:9") - mostly for labels and downstream math, but handy for verifying what the node actually did.
Where people get burned: closest crops. Edges vanish, so if the composition is sensitive to framing, use disabled or a manual ratio. And the megapixel dial lies a little - set target_megapixels to 4.0 and the code still caps you at 1.4M, because the model breaks above that. The README's guidance: a bigger budget gives the model more freedom but more artifacts; smaller gives stronger consistency.
Install
Standard custom-node dance: ComfyUI Manager → Install Custom Nodes → search "comfyui_qwen_image_edit_adv", or clone manually:
cd ComfyUI/custom_nodes
git clone https://github.com/lenML/comfyui_qwen_image_edit_adv
Then restart ComfyUI. No dependency dance - the pack's requirements.txt is empty and it ships no weights. The heavy parts load through ComfyUI's normal Qwen loaders: the 20B Qwen-Image-Edit model (practically a Q4 GGUF - consumer VRAM won't run it at bf16), the Qwen2.5-VL text encoder, and the VAE.
Troubleshooting
Wire it as Load Image → QwenImageEditScale → TextEncodeQwenImageEditAdv → KSampler, and keep CFG low (1.0–2.5) - Qwen follows instructions better there. If the edit comes back at a different aspect than you wanted, check the ratio output and your ratio_strategy. If it looks mushy, the downscale was too aggressive: raise target_megapixels (within the cap) or downscale in two steps. And remember the honest limitation underneath all of this - the model re-emits the whole frame, so even a perfect input resolution won't make unedited pixels pixel-identical.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| upscale_method | COMBO | area | 5 options: area, bicubic, bilinear, nearest-exact, lanczos |
| ratio_strategy | COMBO | closest | 11 options: disabled, closest, 1:1, 2:3, 3:2, 3:4, +5 |
| target_megapixelsopt | FLOAT | 1.000.01–16 | — |
| alignmentopt | INT | 328–128 | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| width | INT | — |
| height | INT | — |
| ratio | STRING | — |