Text Encode Qwen Image Edit Simple Krs
The Qwen Image Edit 'shift' bug, fixed by feeding the image straight in
- clip
- vae
- image1
- image2
- image3
- CONDITIONING
- output_image
Qwen Image Edit is great until the output arrives subtly shifted from what you put in - proportions skewed, the subject leaning wrong, a result that clearly isn't a faithful edit. That's the famous "offset" issue, and it's the whole reason this node exists. It's a drop-in replacement for ComfyUI's built-in Text Encode Qwen Image Edit that pins the input resolution so the model has a fixed frame of reference to come back to. If you've ever had a Qwen edit come out geometrically off, this is the fix you were looking for.
Why the shift happens
Qwen Image Edit doesn't patch your image - it re-emits the whole frame and hopes the parts you didn't touch come back close. The community named the failure: when the resolution the vision encoder sees disagrees with the resolution the sampler's reference latent was encoded at, the model drifts, distorts proportions, and blurs. It's the same input-resolution problem Flux Kontext has. The standard workaround is to control the input size so both views of your image agree. That's exactly what this node automates.
How it works
The node does two separate resizes on your input. First it scales each image to vl_resolution - the size the Qwen2.5-VL text encoder sees when it "reads" the picture. Then, if you've connected a VAE, it scales the image toward 1024×1024, rounds to your alignment, and encodes it into a reference latent that gets attached to the conditioning. That reference latent is what anchors the original content, and it only works if it comes from the same pipeline as the vision encoding. Hence the author's instruction that matters more than any slider: connect your input image directly to this node.
Inputs that matter
- vl_resolution - default 384 matches original Qwen behavior. 1024 gives better clarity and identity following; 512–576 is the sweet spot between clarity and prompt adherence. The trade-off is real: crank it too high and the model starts ignoring parts of your instruction.
- alignment - default 32, options 8 through 64. The VAE resize rounds to a multiple of this so the math stays clean. Leave it alone unless you know why you're changing it.
- system_prompt -
default,minimal, orcustom. If the built-in "describe the image then edit it" prompt is fighting your instruction,minimalgives you a clean slate. - vae + image1 - connect both. No VAE means no reference latent and no
output_image; the offset fix mostly depends on the VAE path.image2/image3are only relevant for multi-image edits on Qwen-Image-Edit-2509 and later.
The outputs are a CONDITIONING (wire it into the KSampler's positive) and output_image - the VAE-resized ~1024px version of your input, handy for previewing exactly what the model saw or passing forward.
Installation
cd ComfyUI/custom_nodes
git clone https://github.com/KursatAs/KrsNodes
Then restart ComfyUI. ComfyUI Manager can also find it by searching "KrsNodes". The pack pulls in nothing beyond what ComfyUI already ships - no extra pip packages, no model downloads. The model is the real dependency: Qwen-Image-Edit is 20B, so realistically you're running a community GGUF quant, not the bf16 weights.
Troubleshooting
- Model ignores part of the prompt - drop
vl_resolutiontoward 512 and retry; higher resolution buys clarity and costs adherence. - Offset persists - double-check the image actually feeds this node, not a separate image-loading path, and that a VAE is connected.
- It's Qwen-only - the README is explicit that these nodes target Qwen Image Edit models and won't do anything useful for other checkpoints. That's by design, not a bug.
One honest caveat: the node fixes the resolution side of the offset, not the whole-frame drift. Qwen still re-emits everything, so faces and unedited regions can drift on a chain of edits - that's the model, not this node. If you need pixel-exact preservation, that's what masked inpainting is still for.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| clip | CLIP | — | |
| prompt | STRING | — | |
| alignment | COMBO | 32 | 6 options: 8, 16, 24, 32, 56, 64 |
| vl_resolution | INT | 384256–2048 | — |
| system_prompt | COMBO | default | 3 options: default, minimal, custom |
| vaeopt | VAE | — | |
| image1opt | IMAGE | — | |
| image2opt | IMAGE | — | |
| image3opt | IMAGE | — | |
| custom_system_promptopt | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| CONDITIONING | CONDITIONING | — |
| output_image | IMAGE | — |