Nodes/ComfyUi-TextEncodeEditAdvanced/TextEncodeEditAdvanced
ComfyUI Node

TextEncodeEditAdvanced

TextEncodeEditAdvanced — the Qwen Image Edit text encoder with a resolution knob

By BigStationW·Created 8 months ago·Updated 7 months ago· 59
TextEncodeEditAdvanced
  • clip
  • vae
  • image1
  • image2
  • image3
  • CONDITIONING
prompt
vl_megapixels0.50
max_images_allowed3

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:

  1. VLM branch: downscales the image to vl_megapixels (area resize) and feeds it to the Qwen2.5-VL encoder through clip.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.
  2. Reference-latent branch: VAE-encodes the same image at full resolution and appends it to the conditioning as reference_latents, which a FluxKontextMultiReferenceLatentMethod node on your sampler consumes.

The inputs that matter

  • clip (required) - must be the Qwen 2.5-VL text encoder, loaded with a CLIPLoader of type qwen_image (qwen_2.5_vl_7b_fp8_scaled.safetensors is 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.safetensors for 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_megapixels above 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.
Categoryconditioning/qwen_image_edit

Inputs (8)

NameTypeDefaultDescription
clipCLIP
promptSTRING
vl_megapixelsFLOAT0.500–4Target 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_allowedCOMBO3Maximum number of images to process. Images are processed in order: image1, image2, image3
vaeoptVAE
image1optIMAGE
image2optIMAGE
image3optIMAGE

Outputs (1)

NameTypeDescription
CONDITIONINGCONDITIONING