TextEncodeEditAdvanced
TextEncodeEditAdvanced — the Qwen Image Edit text encoder with a resolution knob
- clip
- vae
- image1
- image2
- image3
- CONDITIONING
The stock TextEncodeQwenImageEdit node that ships with ComfyUI works - but it hardcodes one thing you can't touch: it downscales your input images to 0.15 megapixels before the vision model ever sees them. TextEncodeEditAdvanced is the tunable replacement, and the knob it adds is the whole point.
Here's the context. Qwen Image Edit is a dual-encoding model: your input image goes into the Qwen2.5-VL text encoder as visual semantic control (it literally looks at the picture and describes it), and simultaneously into the VAE as visual appearance control (the reference-latent mechanism Kontext pioneered). This node drives both branches in one shot, and vl_megapixels controls how much of the image the VLM actually gets to see.
How it works
For each connected image, up to max_images_allowed, the node does two things:
- VLM branch: downscales the image to
vl_megapixels(area resize) and feeds it to the Qwen2.5-VL encoder throughclip.tokenize(), wrapped in a llama-style system prompt that asks the model to describe the image's key features and then explain how your instruction modifies it. That's the "enhance my prompt with a detailed description of the photo" magic. - Reference-latent branch: VAE-encodes the same image at full resolution and appends it to the conditioning as
reference_latents, which aFluxKontextMultiReferenceLatentMethodnode on your sampler consumes.
The inputs that matter
- clip (required) - must be the Qwen 2.5-VL text encoder, loaded with a
CLIPLoaderof typeqwen_image(qwen_2.5_vl_7b_fp8_scaled.safetensorsis what the author's workflow uses). A T5 or CLIP-L won't work here. - prompt (required, multiline) - your plain-language edit instruction: "change her dress to blue," "remove the watermark."
- vl_megapixels - the star of the show. Default 0.5, range 0–4. The Qwen2.5-VL sweet spot is 0.2–1.0 MP. Higher means the VLM sees more detail, which the author reports as better style preservation and less of Qwen's tendency to zoom in on the image. Set it to 0 for non-Qwen edit models - Kontext, Klein, and Flux 2 have no VLM branch, so a nonzero value feeds image tokens to a text encoder that doesn't want them.
- max_images_allowed -
"0"–"3", default"3", processed in order image1→2→3."0"makes this a plain text encoder with no images at all. - vae + image1/2/3 (optional) - the reference-image side.
qwen_image_vae.safetensorsfor Qwen.
Output is a single CONDITIONING feeding your sampler's positive.
Install
ComfyUI Manager: search ComfyUi-TextEncodeQwenImageEditAdvanced. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/BigStationW/ComfyUi-TextEncodeQwenImageEditAdvanced
Restart after. No Python dependencies to fight with - the pack uses only core ComfyUI. The heavy part is models: the edit checkpoint (fp8 or GGUF for sane VRAM), the 2.5-VL text encoder, and the VAE.
Common issues
- Missing node after install - this pack needs a current ComfyUI core for both the VLM encoding and reference latents. The community fix for "TextEncodeQwenImageEdit missing" on older builds was updating ComfyUI (and clearing the browser cache) rather than touching the node.
- Garbage with a Kontext/Klein clip - you left
vl_megapixelsabove 0 on a model with no VLM. Zero it. - Offset or distorted output - the reference branch encodes at full resolution, so a giant input makes a giant latent. The author pre-scales inputs with
ImageScaleToTotalPixels(~1 MP) and so should you. - No VAE connected - you get text-to-image behavior with no reference control, silently.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| clip | CLIP | — | |
| prompt | STRING | — | |
| vl_megapixels | FLOAT | 0.500–4 | Target megapixels for Vision-Language model. Set to 0 to disable VL image feeding. Recommended: 0.2-1.0 MP. Qwen2.5-VL trained range: 0.2-1.0 MP |
| max_images_allowed | COMBO | 3 | Maximum number of images to process. Images are processed in order: image1, image2, image3 |
| vaeopt | VAE | — | |
| image1opt | IMAGE | — | |
| image2opt | IMAGE | — | |
| image3opt | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| CONDITIONING | CONDITIONING | — |