Nodes/comfyui-plugins/TextEncodeQwenImageEditPlusAlt
ComfyUI Node

TextEncodeQwenImageEditPlusAlt

Four reference images, one Qwen edit — the multi-image encoder

By HDembinski·Created 4 months ago·Updated 4 months ago· 0
TextEncodeQwenImageEditPlusAlt
  • clip
  • vae
  • image1
  • image2
  • image3
  • image4
  • target_latent
  • CONDITIONING
prompt

The Plus is what you reach for when one reference image isn't enough. Where TextEncodeQwenImageEditAlt takes a single picture and an instruction, this node takes up to four input images (image1 through image4) plus an optional target_latent, and turns the lot into one CONDITIONING. That's the capability Qwen-Image-Edit-2509 added: multi-image editing, the person+product, person+scene and person+person compositions that product photography and try-on workflows are built on. "Put this person next to this product," "swap this face onto this body" - you hand it both pictures and a sentence.

Mechanically it's the same dual-encoding story as the Alt, with two important wrinkles. Each image you connect gets shrunk to fit a 384×384 box (lanczos downscale, center-cropped to a square) and becomes a vision token in a Qwen chat template - the node builds the <|im_start|> system prompt itself ("describe key details… then explain how the user's instruction should alter the image"), slots each image in with <|vision_start|><|image_pad|><|vision_end|> placeholders, and appends your prompt at the end. If vae is connected, each reference is also VAE-encoded into reference_latents, which is what carries the actual appearance the sampler should respect. The thumbnails are for the vision encoder's understanding; the pixels you care about live in those latents.

The second wrinkle is target_latent, and it's the input that separates this node from a beginner trap. Qwen-Image-Edit's best-documented failure mode is geometric offset - the output comes back shifted and distorted because the input and output resolutions don't agree. The community fix is to control input resolution to match what you're about to generate. This node automates that: wire in the same latent you're sampling into (the LATENT output of your empty-latent node, before the KSampler) and it resizes every reference image to that target's pixel size (latent dims × 8) before encoding. Do it. It's optional, but it's the difference between an edit that holds and one that drifts.

Inputs that actually matter: image1 (the main subject - 2509 is optimal at one to three images, so four is technically supported but diminishing), prompt (the instruction, multiline), vae (connect it or you lose the appearance anchor, same rule as the Alt), and target_latent (recommended). Output is a single CONDITIONING into your sampler. Same warning as the whole Qwen-Edit family: the model re-emits the entire frame, so unedited pixels move and unfamiliar faces drift worst - for anything that must be pixel-exact, crop-and-stitch around a mask instead.

Install is the pack's standard: ComfyUI Manager → comfyui-plugins, or git clone https://github.com/HDembinski/comfyui_plugins into ComfyUI/custom_nodes, then restart. No runtime deps, no model files in the repo - you supply the Qwen-Image-Edit checkpoint (a GGUF quant if you're on a consumer card). Because the pack uses the new comfy_api.latest plugin API, it needs a current ComfyUI; a stale install just won't show these nodes, so update ComfyUI first when troubleshooting.

Categoryadvanced/conditioning

Inputs (8)

NameTypeDefaultDescription
clipCLIP
promptSTRING
vaeoptVAE
image1optIMAGE
image2optIMAGE
image3optIMAGE
image4optIMAGE
target_latentoptLATENT

Outputs (1)

NameTypeDescription
CONDITIONINGCONDITIONING