ComfyUI Node

Inpainting

The sampler at the heart of this pack's diffusers inpainting stack

By Pfaeff·Created 3 years ago·Updated 2 years ago· 22
Inpainting
  • inpainting_pipeline
  • image
  • mask
  • IMAGE
text
num_inference_steps20
guidance_scale8.00

This is the workhorse of the pack's inpainting trio. InpaintingPipelineLoader hands you a pipeline, ImagePadForBetterOutpaint hands you a padded image and a mask, and this node runs the actual diffusion: image + mask + prompt → regenerated image. Under the hood it's a thin wrapper around HuggingFace diffusers' StableDiffusionInpaintPipeline, which puts it in a different universe from ComfyUI's core inpainting (safetensors checkpoints, VAEEncodeForInpaint, a denoise dial). Here you get two dials - steps and guidance - and that's the whole control surface.

How it works

The node takes the INPAINT_PIPELINE object from the loader plus image, mask and prompt, converts the mask from a float tensor to an 8-bit image (values × 255), and runs the pipeline once per frame in the batch. The output is a full-frame IMAGE - the masked region regenerated, the rest coming through the pipeline's own blending.

Two practical details worth knowing. First, because the mask becomes an 8-bit grayscale image, a soft or feathered mask turns into mid-gray values and the pipeline treats that as partial regeneration - you get ghosting. Feed it a hard black-and-white mask. Second, there's no denoise strength exposed, and diffusers' inpaint pipeline defaults to strength 1.0, meaning the masked region is fully regenerated. You can't dial in "just a bit darker" the way core's inpainting lets you - this node is full regeneration inside the mask, full stop. That's the bluntest corner of this pack.

The inputs that matter

  • inpainting_pipeline (INPAINT_PIPELINE) - the output of InpaintingPipelineLoader; nothing else in the ecosystem produces this type.
  • image (IMAGE) and mask (MASK) - the thing being fixed and where.
  • text (STRING, multiline) - the prompt for what should be in the masked region. Describe what belongs behind the thing you're removing, not the thing itself, or the model invents clutter.
  • num_inference_steps (INT, default 20) - plenty for SD-class models; don't crank it for quality, you'll just wait longer.
  • guidance_scale (FLOAT, default 8.0) - SD-class guidance, the 7–9 range is normal. High values oversaturate the masked region.

Output is a single IMAGE: the full inpainted frame.

One thing you should know before you trust the output

Masked inpainting's remaining superpower in 2026 is bit-identical unmasked pixels - and this node doesn't hand that to you free. The whole image goes through the pipeline, which means the unmasked area also passes through VAE encode/decode and drifts slightly. If pixel-exactness matters (it's the entire reason to still use masks over an instruction-editing model), composite the inpainted region back over the original with ImageCompositeMasked afterward - that's the community's oldest inpainting rule, and this pack leaves it to you. For outpainting there's nothing to preserve, so it doesn't matter there.

How to install it

Shared with the pack - a work in progress whose README says "not tested, yet" (author Pfaeff, a diffusers-era SD community handle). ComfyUI Manager if it's in the registry, or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/Pfaeff/pfaeff-comfyui

then restart. Dependencies (opencv-python-headless, diffusers) auto-install on first load.

Common issues & troubleshooting

It hangs forever on the first run. That's not this node - the loader is downloading the model. Check the loader's node (and see its article) for the download details.

Ghosting in the masked area. Your mask is soft or feathered. Threshold it to hard black/white before feeding it here.

Oversaturated or blown-out masked region. Guidance too high. Drop toward 7, or take num_inference_steps up a bit for cleaner edges.

Unmasked pixels look slightly off. Expected - this node re-decodes the whole frame. Composite the original back under the inpainted region with ImageCompositeMasked if you need the untouched parts untouched.

CategoryPfaeff/inpainting

Inputs (6)

NameTypeDefaultDescription
inpainting_pipelineINPAINT_PIPELINE
imageIMAGE
maskMASK
textSTRING
num_inference_stepsINT20
guidance_scaleFLOAT8.00

Outputs (1)

NameTypeDescription
IMAGEIMAGE