Nodes/comfyui_qwen_image_edit_adv/TextEncodeQwenImageEditAdv
ComfyUI Node

TextEncodeQwenImageEditAdv

The Qwen edit encoder with the hidden resize ripped out

By lenML·Created 12 months ago·Updated 9 months ago· 38
TextEncodeQwenImageEditAdv
  • clip
  • vae
  • image
  • CONDITIONING
  • LATENT
prompt

This is the heart of the pack. ComfyUI's built-in TextEncodeQwenImageEdit works, but it has a hidden resize baked in: it forces your input image to a specific size before encoding, and that forced resize is exactly why your Qwen edits come back shifted. TextEncodeQwenImageEditAdv is the same encoder with the scaling yanked out and the logic cleaned up. You control the size upstream, with the pack's scale nodes; this node just encodes.

Why that matters: Qwen-Image-Edit is a 20B editor that re-emits the whole frame. Every pixel comes back, changed or not, and if the reference went into the model at a different resolution than the one you're looking at, the output is geometrically offset from your original - characters stretched, composition skewed. It's the same input-resolution quirk Flux Kontext has, and the community fix has always been "control the input size." This pack's whole thesis is that you should do that yourself, explicitly, instead of letting the encoder guess. Decouple scaling from encoding and you control exactly what dimensions the model sees.

How it works

From the source, it does three things. It tokenizes your prompt with the image attached, so the vision model actually sees the picture. If you've wired a VAE, it encodes the image into a latent and attaches it to the conditioning as a reference_latent - that's the "appearance control" half of the model's dual-encoding design. And it returns both halves of what the sampler needs: a CONDITIONING and a LATENT.

Inputs and outputs

  • clip (required) - from the CLIPLoader, using the qwen_image type.
  • prompt (required) - the edit instruction, plain language: "change her dress to blue", "remove the watermark".
  • vae (optional) - wire it. If you don't, the LATENT output is empty and there's nothing to edit from.
  • image (optional) - the reference, ideally pre-scaled by QwenImageEditSimpleScale.

Outputs: CONDITIONING and LATENT. Both go into the KSampler - the conditioning carries the instruction plus the reference latent, and the latent is the canvas the sampler starts from.

Install

Standard custom-node install: 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

Restart ComfyUI. No dependency dance - the requirements.txt is empty and the pack ships no weights. You still need the model itself: the 20B Qwen-Image-Edit (practically a Q4 GGUF on consumer hardware), the Qwen2.5-VL text encoder, and the VAE, all through ComfyUI's normal Qwen loaders. The repo's demo_compare.json shows the pack's nodes side by side with the built-in one so you can see the offset difference yourself.

Troubleshooting

If your edit drifts or proportions skew, the resolution is the first thing to suspect - route the image through SimpleScale at 1024 first. If the KSampler complains about a missing latent, you forgot the VAE. Keep CFG at 1.0–2.5; Qwen follows instructions better at low CFG, and cranking it just amplifies drift. And keep the honest limitation in mind: this is still whole-frame re-emission, so faces drift across a chain of edits and untouched pixels come back close-but-not-identical. The README points at low-res-fix and consistency LoRAs if you need more.

CategoryQwenImageEditAdv/conditioning

Inputs (4)

NameTypeDefaultDescription
clipCLIP
promptSTRING
vaeoptVAE
imageoptIMAGE

Outputs (2)

NameTypeDescription
CONDITIONINGCONDITIONING
LATENTLATENT