Inpaint
Two-pass masked inpainting that keeps the unmasked pixels pixel-identical
- image
- mask
- model
- vae
- positive
- negative
- image
Masked inpainting still owns one job no instruction-editing model can touch: change exactly the masked region and leave every other pixel bit-identical. Inpaint is this pack's take on it, and it's built as a two-pass pipeline that solves the classic low-resolution-mask problem: you inpaint at native resolution and the region gets mushy, or you inpaint big and blow your VRAM. This node does both passes so you don't have to.
Here's the mechanism, which the pack's source comments spell out nicely:
- Pass 1: the image and mask are downscaled to ~1MP (rounded to multiples of 8), the mask is attached to the latent as a noise mask, and it samples. Small enough to fit VRAM, big enough for the model to do something coherent.
- Pass 2: the pass-1 result is upscaled back to the original resolution (optionally through an upscale model), the inpainted region is composited onto the original, the mask is gaussian-blurred (
blur_radiusdefault 20), and a second low-denoise sample runs to blend the seam and add detail back.
The blur-and-resample second pass is the part that makes the edge disappear - a hard mask edge is where the tell-tale inpainting seam lives, and softening it before the detail pass is the fix.
The inputs that matter
imageandmask- the source and where to paint. Feed the mask from any segmentation or manual mask node.model,vae,positive,negative,seed- the standard conditioning set; this standalone node takes them explicitly (a pipe variant exists too).- The sampler panel is split in two:
inpaint_sampler/inpaint_scheduler/inpaint_steps/inpaint_cfg/inpaint_denoise(default 1.0) control pass 1, anddetail_sampler/detail_scheduler/detail_steps/detail_cfg/detail_denoise(default 0.2) control the pass-2 blend. Keep pass-1 denoise at 1.0 for full regeneration of the mask, and pass-2 low - 0.2 is the sweet spot for blending without re-rendering the whole region. upscale_model- optional model for the upscale between passes;noneuses Lanczos.blur_radius- the mask blur for pass 2, 0 to disable.
Output is the final image.
Installing it
In mudknight-utils - ComfyUI Manager (search comfyui-mudknight-utils) or:
cd ComfyUI/custom_nodes
git clone https://github.com/mudknight/comfyui-mudknight-utils
No Impact Pack required - this is core sampler code with a custom two-pass loop.
Where people get burned
Two things to know before you lean on it. First, on a big canvas the downscale-to-1MP first pass means fine texture inside the mask can come back softer than the untouched surroundings - that's why the low-denoise second pass exists, but if the region still reads "smooth," raise the detail denoise slightly rather than the inpaint denoise. Second, and this is the honest context from the inpainting world: if your goal is "change this thing and keep everything else identical," masked inpainting is still the right tool - but for "remove this object / restyle the scene," the instruction-editing models (Flux Kontext, Qwen-Image-Edit) took most of that job over in the last year. Use masks where pixel-exactness matters, not where a sentence would do.
Inputs (19)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| mask | MASK | — | |
| model | MODEL | — | |
| vae | VAE | — | |
| positive | CONDITIONING | — | |
| negative | CONDITIONING | — | |
| seed | INT | 00–18446744073709550000 | — |
| inpaint_sampler | COMBO | euler_ancestral_cfg_pp | 44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38 |
| inpaint_scheduler | COMBO | karras | 10 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +4 |
| inpaint_steps | INT | 201–10000 | — |
| inpaint_cfg | FLOAT | 1.50–100 | — |
| inpaint_denoise | FLOAT | 1.000–1 | — |
| detail_sampler | COMBO | euler_ancestral_cfg_pp | 44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38 |
| detail_scheduler | COMBO | karras | 10 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +4 |
| detail_steps | INT | 201–10000 | — |
| detail_cfg | FLOAT | 1.50–100 | — |
| detail_denoise | FLOAT | 0.200–1 | — |
| upscale_model | COMBO | 1 options: none | |
| blur_radius | INT | 200–512 | Gaussian blur radius applied to mask before pass 2. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |