Qwen Image Edit+ (Mask)
The mask input Qwen-Image-Edit was never given
- clip
- vae
- image1
- image2
- image3
- mask
- CONDITIONING
Qwen-Image-Edit isn't an inpainting model. It takes your whole image into context and emits a whole new one, and the stock ComfyUI node for it - TextEncodeQwenImageEditPlus - has no mask input at all. You literally cannot tell it "only touch this region." Qwen Image Edit+ (Mask) is a modified copy of that core node with a MASK input added, and it's the thing that makes partial edits on Qwen worth attempting.
The mechanism is a hack, but a smart one. When you connect a mask, the node bakes it into the first reference image as a red highlight overlay - so the vision-language model can see which region you mean - and appends a region hint to your prompt that spells it out: the red region is the only area to change, keep everything outside it exactly as-is. The reference latents are still encoded from the original, unmasked image, so Qwen keeps the true structure of the source while it's told where to work.
That's the key word: told. This is a hint, not a hard constraint. The model can still wander. Which is exactly why the pack pairs this node with Composite Masked (Hash-Perfect) - the encoder persuades Qwen to edit in the right place, and the composite node enforces the boundary in pixel space afterwards, guaranteeing everything outside the mask is bit-identical to your original. Together they turn Qwen's whole-frame re-emission from a liability into something you can use for real local edits.
The inputs that matter
- clip - your Qwen CLIP model.
- prompt - the edit instruction, plain language. Same style you'd use on the core node.
- vae - needed to build the reference latents from your input images.
- image1 / image2 / image3 - one to three reference images, like the 2509+ multi-image workflow. The mask applies to image1, the edit target.
- mask - the optional MASK input that's the whole point. White = edit here, black = leave alone.
Output is a standard CONDITIONING, which is the nice part: it's wiring-compatible with the existing Qwen KSampler workflow. Swap the core encoder for this node, keep everything else, and the graph just works.
Gotchas
The mask only does anything when it's connected alongside image1 - a mask with no image to attach to is silently ignored, and you won't get a hint in the prompt. Also remember the honesty rule from above: the model is being shown where to edit, not forced to stay there. Skip the composite node and you'll get most-of-the-frame preserved rather than bit-identical, which is where people get burned.
The heavy dependency is the model itself, not this node. Qwen-Image-Edit is a 20B model; in practice you'll run a quantized GGUF or fp8 checkpoint, and you need it, its CLIP, and a VAE loaded before this encoder does anything. That's the real setup cost.
Installing it
ComfyUI Manager → search comfyui_qwen_edit_pixel_perfect → install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/oron1208/comfyui_qwen_edit_pixel_perfect
Then restart ComfyUI. No OpenCV needed here, and no extra model files - just the Qwen stack you already have. The pack is built on the newer comfy_api.latest / io.Schema node API, so if the node never appears in your node list, update ComfyUI before you go hunting for anything else. One nicety of the implementation: it's a copy of the core encoder rather than a patch to comfy_extras/nodes_qwen.py, so ComfyUI updates don't clobber it.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| clip | CLIP | — | |
| prompt | STRING | — | |
| vaeopt | VAE | — | |
| image1opt | IMAGE | — | |
| image2opt | IMAGE | — | |
| image3opt | IMAGE | — | |
| maskopt | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| CONDITIONING | CONDITIONING | — |