⭐ Star Flux2/Qwen-Image-Edit Inpainter
The crop-inpaint-stitch subgraph, collapsed into one node that Flux2 understands
- model
- clip
- vae
- image
- mask
- reference_image_1
- reference_image_2
- reference_image_3
- reference_image_4
- image
- latent
- mask
- seed
Masked inpainting in ComfyUI is, on paper, simple: mask a region, regenerate just that region. In practice it's a subgraph - crop the image to the mask's bounding box, grow and blur the mask so the edges blend, run the sampler over only that area, then stitch the result back. Get any step wrong and you get seams, black borders, or a mask that's ignored entirely. Star Flux2/Qwen-Image-Edit Inpainter does the whole crop-sample-stitch pipeline inside a single node, tuned for the Flux2 and Qwen-Image-Edit models - and it's one of the most impressive consolidations in the StarNodes pack.
It's in ⭐StarNodes/Sampler.
How it works
You feed it model, clip, vae, the image, a mask, and text ("what do you want to inpaint?"). Then the node does the work the crop-and-stitch workflow used to need a dozen nodes for:
- Crop - finds the mask's bounding box and crops image + mask down to it, so the sampler only spends compute on the region that changes.
- Blend prep - grows and blurs the mask (
grow_and_blur_mask) so the edited region feathers into the original instead of showing a hard seam. It also mirrors the image edges so there's no black-border bleed when the inpaint conditioning crops the context - a real bug people hit with plaininpaintmodelconditioning. - Sample - runs the sampler over the cropped region with your
steps(20),cfg(5),sampler_name(euler),scheduler(simple) anddenoise(1.0). - Stitch - pastes the inpainted crop back over the original with the blended mask.
Two Flux2-aware touches make it work well rather than just work. use_inpaint_area_as_reference (default on) feeds the inpaint area to the model as a reference image, so the regenerated content matches the surrounding image's style and palette - that's the classic Flux2 edit-consistency trick. And there are four optional reference_image_1 … reference_image_4 inputs, letting you condition the inpaint on additional references (a character sheet, a style sample) the same way the Flux2 conditioner does.
Outputs
image (the finished composite), latent and mask (the working objects, if you want to inspect or reuse them), and seed (the actual seed used, so you can reproduce a result).
Why you'd use it
Masked inpainting still has things instruction-editing models can't do - bit-identical pixels outside the mask, full-resolution detail in a small crop, a real denoise dial (see the KB's inpainting guide for the full argument). This node keeps those advantages while removing the wiring tax, which is exactly where a pack like StarNodes earns its keep. If you're on a 12GB card, the cropping is also a quiet VRAM win: the sampler only ever sees the crop, not the full image.
Installing it
Standard StarNodes install - ComfyUI Manager, search Starnodes, install, restart:
cd ComfyUI/custom_nodes
git clone https://github.com/Starnodes2024/ComfyUI_StarNodes
cd ComfyUI_StarNodes
pip install -r requirements.txt
Search the canvas for star - it's under ⭐StarNodes/Sampler.
Gotchas
Because so much is hidden, when it misbehaves it's hard to see why. The classic failure is a mask that's too tight - a hard-edged mask with no feather produces a visible boundary no matter how good the model is; the node's internal blur helps, but give it a soft mask from the start. Second, this expects a real model, clip and vae wired in - it's a sampler, not a loader, so you still need the pack's start node or a standard loader upstream (the Qwen starter or Flux start node both work). And denoise below 1.0 leaves some original pixels in the masked area, which is a feature for subtle edits but will confuse you the first time you expect a full replacement. Check the seed output if you're chasing a result - that's the number to lock.
Inputs (17)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| clip | CLIP | — | |
| vae | VAE | — | |
| image | IMAGE | — | |
| mask | MASK | — | |
| text | STRING | — | |
| seed | INT | 00–18446744073709550000 | — |
| steps | INT | 201–10000 | — |
| cfg | FLOAT | 5.000–100 | — |
| sampler_name | COMBO | euler | 44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38 |
| scheduler | COMBO | simple | 9 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +3 |
| denoise | FLOAT | 1.000–1 | — |
| use_inpaint_area_as_reference | BOOLEAN | true | Feed the inpaint area to the model as a reference image. Helps Flux2 keep style and content consistent with the surrounding image. |
| reference_image_1opt | IMAGE | — | |
| reference_image_2opt | IMAGE | — | |
| reference_image_3opt | IMAGE | — | |
| reference_image_4opt | IMAGE | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| latent | LATENT | — |
| mask | MASK | — |
| seed | INT | — |