Qwen Inpainting Sampler
Masked inpainting with strength control for Qwen
- model
- positive
- negative
- latent_image
- mask
- LATENT
Qwen-Image-Edit is great at instruction edits but has one structural weakness: it re-emits the whole frame, so pixels you never asked to touch come back slightly different, and the drift compounds. The fix the community keeps landing on is to put a mask back around it and only let the model change the region you painted. QwenInpaintSampler is a diffusers-pattern inpainting sampler that does exactly that - you give it a latent, a mask, and a strength, and it confines the edit to the masked area.
The pack lists this among its experimental nodes, so treat it as capable-but-rough rather than a polished production sampler. Still, for the very common "edit just his shirt, leave his face alone" job, having a real masked sampler beats letting a full-frame edit wander.
How it works
It follows the diffusers inpainting approach: the masked region gets denoised toward your prompt while the unmasked region is anchored to the original latent, with a strength control governing how hard the change is pushed. That's the important lever - at strength 1 the masked area is fully regenerated; lower it and you blend the new content with what was there, which is how you keep an edit from looking pasted in. It defaults to 8 steps and true_cfg_scale 1, which reads like it's tuned for the fast, step-reduced (Lightning-LoRA) way most people actually run the 20B Qwen model.
There's also a padding_mask_crop option, which crops around the mask before sampling so the model works on a tight region at full detail rather than the whole image - the crop-and-stitch idea, built in.
The inputs and outputs that matter
model,positive,negative- your Qwen model and the conditioning from a Qwen encoder.latent_image(required,LATENT) - the image you're inpainting, as a latent.mask(required,MASK) - the region to change. This is the whole point; everything outside it is protected.strength(default 1.0) - how completely the masked area is regenerated. Drop it to blend rather than fully replace.steps(default 8) andtrue_cfg_scale(default 1.0) - low defaults suited to step-reduced Qwen setups; raise them if you're running the model at full steps.padding_mask_crop(default 0, optional) - crop around the mask for detail; set a pixel padding to enable it.
Output: a single LATENT to hand to your VAE decode.
How to install it
ComfyUI Manager: search ComfyUI-QwenImageWanBridge, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/fblissjr/ComfyUI-QwenImageWanBridge
then restart. Needs a Qwen-Image-Edit checkpoint and the Qwen2.5-VL encoder in the graph; no model of its own.
Common issues & troubleshooting
The edit bleeds outside the mask. Check that your mask is clean and actually covers only what you want changed. Feathering the mask edges helps the transition, but a sloppy mask is the usual culprit for spill.
The inpaint looks pasted-in or too aggressive. Lower strength so the new content blends with the original rather than fully overwriting it, and consider padding_mask_crop so the model sees context around the region.
It's experimental - expect rough edges. The pack files this under its experimental nodes. If it misbehaves and you just need reliable masked editing, the mainstream route is Qwen-Image-Edit with a native crop-and-stitch inpaint workflow. This node is the pack's own take on it, not the battle-tested path.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| positive | CONDITIONING | — | |
| negative | CONDITIONING | — | |
| latent_image | LATENT | Accepts 4-channel (standard ComfyUI) or 16-channel (Qwen) latents. 4-channel will be auto-converted. | |
| mask | MASK | — | |
| strength | FLOAT | 1.000–1 | Inpainting strength (0=preserve original, 1=complete regeneration) |
| steps | INT | 81–100 | Inference steps (8 recommended for Lightning LoRA) |
| true_cfg_scale | FLOAT | 1.00–10 | True CFG scale from diffusers implementation |
| sampler_name | COMBO | euler | 44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38 |
| scheduler | COMBO | normal | 9 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +3 |
| seed | INT | 00–18446744073709550000 | — |
| padding_mask_cropopt | INT | 00–512 | Crop padding around mask (0=disabled, may cause shape errors if enabled) |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LATENT | LATENT | — |