Nodes/ComfyUI_MiraSubPack/Text Encode QwenImage Edit Mira
ComfyUI Node

Text Encode QwenImage Edit Mira

The text encoder QwenImage-Edit needs, without hunting for the right fork

By mirabarukaso·Created 9 months ago·Updated 2 months ago· 0
Text Encode QwenImage Edit Mira
  • clip
  • vae
  • image
  • CONDITIONING
prompt

Here's the thing about QwenImage-Edit that trips up everyone on the first try: it's not a "type a prompt, get an image" model. It's an instruction-editing model, and the text encoder has to understand both your sentence and the image you're editing, then bake the reference image into the conditioning. The stock TextEncodeQwenImageEdit that ships with ComfyUI does this, but it's been through enough versions that the one that matches your checkpoint matters. This node is a known-good port of the fixed text-encode node from Phr00t's Qwen-Image-Edit-Rapid-AIO project, so it's the piece people hunt for when the vanilla encoder quietly misbehaves.

This matters because Qwen-Image-Edit basically ate the "change this thing in this picture" job - object removal, garment swaps, relighting, re-pose - the work that used to take a mask plus ControlNet plus an IP-Adapter. When the model itself is that good, the node in front of it becomes the bottleneck, and a mismatched encoder is exactly the kind of thing that produces edits that ignore your instruction.

How it works

clip is a QwenImage CLIP loader, and prompt is your instruction ("make her wearing a red coat", "remove the phone from his hand"). If you also wire in image and a vae:

  1. The node scales the image down to roughly 1 megapixel, keeping the aspect ratio.
  2. It encodes the image with the VAE to get a reference_latent.
  3. It tokenizes your prompt with the image attached - the CLIP sees the picture, so the instruction has context - then stuffs the reference latent into the conditioning.

That reference latent is the "here's what we're editing" anchor. Without it, you'd be generating from nothing; with it, the sampler knows what to modify. The output is a single CONDITIONING that feeds straight into your KSampler (or the QwenImage-Edit sampler node of your choice).

If you leave vae/image disconnected, it degrades gracefully to a plain text encode - useful for QwenImage text-to-image where no reference is needed.

The inputs that matter

  • clip - required. A QwenImage CLIP.
  • prompt - required, multiline. The edit instruction, in natural language.
  • image (optional) - the picture to edit. Wire it if you're editing.
  • vae (optional) - required to build the reference latent when image is connected.

Install

It's part of the MiraSubPack, so:

cd ComfyUI/custom_nodes
git clone https://github.com/mirabarukaso/ComfyUI_MiraSubPack

or search "MiraSubPack" in ComfyUI Manager and restart. No extra dependencies - this node only leans on node_helpers and comfy.utils, both already in ComfyUI.

Notes and gotchas

  • The reference image is downscaled to ~1MP before encoding. If you're editing something where fine detail matters (a logo, a face), that's worth knowing - the sampler never sees the full-res source, only the latent. The pack's "Plus" variant gives you vl_image_size and reference_latents_size knobs if you need more control.
  • This is a port of community-fixed code, which means it's a bit of a "trust me, this is the version that works" node rather than a maintained original. For the flagship QwenImage-Edit workflows it's been a reliable drop-in, and the fact that it's bundled here means you don't have to go fork-hunting.
  • If your edit comes out looking like a fresh generation instead of a modification, check that image and vae are actually connected - a silently-disconnected reference latent is the classic failure mode.
CategoryMira/SubPack/QwenImage

Inputs (4)

NameTypeDefaultDescription
clipCLIP
promptSTRING
vaeoptVAE
imageoptIMAGE

Outputs (1)

NameTypeDescription
CONDITIONINGCONDITIONING