Nodes/MachinePainting Nodes/πŸ‘Ύ Inpaint Mask Pro
ComfyUI Node

πŸ‘Ύ Inpaint Mask Pro

Stop letting sloppy inpaint regions bleed into the frame

By machinepaintingΒ·Created 10 months agoΒ·Updated 4 months agoΒ· 9
πŸ‘Ύ Inpaint Mask Pro
  • image
  • inpaint_mask
  • mask
  • image_thru
  • mask
  • mask_bw
  • preview_out
β—„invert_maskfalseβ–Ί
β—„inpaint_expand0β–Ί
β—„inpaint_blur0.0β–Ί
β—„show_in_masktrueβ–Ί
β—„in_mask_colorredβ–Ί
β—„in_mask_opacity0.50β–Ί
β—„use_maskfalseβ–Ί
β—„mask_blur0.0β–Ί
β—„mask_expand0β–Ί
β—„show_maskfalseβ–Ί
β—„mask_colorlime_greenβ–Ί
β—„mask_opacity0.30β–Ί

If you've ever drawn an inpaint mask freehand - or let an external tool generate one - you know they come out sloppy: bleeding over edges, covering half the face, feathering where they shouldn't. And because ComfyUI's Load Image node doesn't take a mask input, you've probably wrestled with whether your mask even made it into the sampler. Inpaint Mask Pro exists for exactly this mess. It combines your inpaint mask with an optional clean silhouette mask, so the inpaint only fires where you actually want it, and hands you the cleaned result plus a color overlay so you can see what you're about to regenerate.

How it works

Two masks go in:

  1. inpaint_mask (required) - your sloppy inpaint region. You can flip it with invert_mask, grow or shrink it with inpaint_expand (βˆ’100 to 100), and soften its edges with inpaint_blur (0–50). This is the mask the sampler will actually use.
  2. mask (optional, gated by use_mask) - a clean silhouette, e.g. the subject cut out by a background-removal node. When enabled, the inpaint region gets cropped to this silhouette, which is the whole trick: a messy inpaint stroke that wanders off the subject gets clipped back to the subject's boundary instead of regenerating the background. mask_expand and mask_blur tune that crop mask too.

Outputs: image_thru (the original image, passed through for easy chaining), mask (the final processed mask - wire this to your ConditioningSetMask or sampler), mask_bw (the same mask as a viewable B&W image), and preview_out (a color overlay composite).

The preview that saves your skin

The color overlay is where this node earns its keep. Each mask gets its own color and opacity, both independently toggleable: the inpaint layer (show_in_mask, default red at 0.5) and the crop layer (show_mask, default lime green at 0.3). You get red = "will be regenerated," green = "the crop boundary," and you can see at a glance whether your inpaint is going to eat the subject's hair or stop at its ear. That's the difference between a good inpaint and a "why did it regrow the ear" inpaint.

Install

MachinePainting Nodes pack:

cd ComfyUI/custom_nodes
git clone https://github.com/machinepainting/ComfyUI-MachinePaintingNodes.git
pip install -r requirements.txt

or ComfyUI Manager β†’ "MachinePaintingNodes" β†’ install β†’ restart.

Gotchas

Version history matters here: in v2.1.2 the pack removed SEGS support and made inpaint_mask required - so if a workflow you downloaded expects an older signature, update the pack. Mask-to-image resolution mismatches are handled (the crop mask is resized to the image), but the inpaint mask should already match your image or you'll get silent misalignment. And don't forget the mask-inpaint's place in the 2026 landscape: for small, precise fixes nothing beats mask-based inpainting because the untouched pixels stay bit-identical, while whole-image edit models drift everything. This node is how you keep that workflow clean and visible instead of flying blind.

CategoryMachinePaintingNodes/Mask

Inputs (15)

NameTypeDefaultDescription
imageIMAGEβ€”
inpaint_maskMASKβ€”
invert_maskoptBOOLEANfalseβ€”
inpaint_expandoptINT0-100–100β€”
inpaint_bluroptFLOAT0.00–50β€”
show_in_maskoptBOOLEANtrueβ€”
in_mask_coloroptCOMBOred4 options: red, light_blue, black, white
in_mask_opacityoptFLOAT0.500–1β€”
use_maskoptBOOLEANfalseβ€”
maskoptMASKβ€”
mask_bluroptFLOAT0.00–50β€”
mask_expandoptINT0-100–100β€”
show_maskoptBOOLEANfalseβ€”
mask_coloroptCOMBOlime_green4 options: lime_green, purple, black, white
mask_opacityoptFLOAT0.300–1β€”

Outputs (4)

NameTypeDescription
image_thruIMAGEβ€”
maskMASKβ€”
mask_bwIMAGEβ€”
preview_outIMAGEβ€”