ComfyUI Node

Inpaint

Two-pass masked inpainting that keeps the unmasked pixels pixel-identical

By mudknight·Created 8 months ago·Updated 2 months ago· 1
Inpaint
  • image
  • mask
  • model
  • vae
  • positive
  • negative
  • image
seed0
inpaint_samplereuler_ancestral_cfg_pp
inpaint_schedulerkarras
inpaint_steps20
inpaint_cfg1.5
inpaint_denoise1.00
detail_samplereuler_ancestral_cfg_pp
detail_schedulerkarras
detail_steps20
detail_cfg1.5
detail_denoise0.20
upscale_model
blur_radius20

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_radius default 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

  • image and mask - 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, and detail_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; none uses 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.

Categorymudknight/inpainting

Inputs (19)

NameTypeDefaultDescription
imageIMAGE
maskMASK
modelMODEL
vaeVAE
positiveCONDITIONING
negativeCONDITIONING
seedINT00–18446744073709550000
inpaint_samplerCOMBOeuler_ancestral_cfg_pp44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38
inpaint_schedulerCOMBOkarras10 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +4
inpaint_stepsINT201–10000
inpaint_cfgFLOAT1.50–100
inpaint_denoiseFLOAT1.000–1
detail_samplerCOMBOeuler_ancestral_cfg_pp44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38
detail_schedulerCOMBOkarras10 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +4
detail_stepsINT201–10000
detail_cfgFLOAT1.50–100
detail_denoiseFLOAT0.200–1
upscale_modelCOMBO1 options: none
blur_radiusINT200–512Gaussian blur radius applied to mask before pass 2.

Outputs (1)

NameTypeDescription
imageIMAGE