ComfyUI Node

Stack_inpaint

Two Inpainting Modes, and Which Mask Color Goes With Which Base Model

By cardenluo·Created 2 years ago·Updated 21 days ago· 309
Stack_inpaint
  • latent_image
  • latent_mask
  • inpaint
control_netNone
mask_modeAilmama
smoothness0.00
strength1.000
start_percent0.000
end_percent1.000

This is one of the most genuinely useful nodes in the pack, because its own description spells out something a lot of people learn the hard way: inpainting isn't one technique any more, it's two, and which one you want depends on your base model. Stack_inpaint bundles both.

Mode one: no ControlNet selected

Leave control_net at None and the node samples using ComfyUI's own InpaintModelConditioning internally - the exact node the community has converged on in 2026 for getting real masked inpainting out of edit models, since it's what lets you keep a denoise dial and a mask boundary that instruction-editing models don't otherwise give you. The pack's own description splits this into two use cases:

  • Low-noise repaint: works on any model, for subtle detail fixes and minor changes.
  • High-noise repaint: for image-editing models specifically - Qwen Image Edit, Kontext - where a bigger change is expected.

Mode two: a ControlNet selected

Pick a control_net and the node switches to CN-driven inpainting, using a dedicated inpainting ControlNet checkpoint. Here mask_mode isn't cosmetic - it's telling you which color your mask needs to be preprocessed into for the ControlNet checkpoint your base model actually uses, because different inpainting ControlNets were trained expecting different mask conventions:

  • SD repaintmask_black
  • XL repaintmask_white
  • Flux repaintAlimama (the widely-used Alimama-Creative Flux inpainting ControlNet)
  • Qwen-Image repaintAlimama

Get this wrong - say, feed a black-preprocessed mask to a checkpoint trained on white masks - and don't be surprised if the "protected" and "target" regions end up swapped or the blend looks wrong at the edges.

Inputs

  • control_net (optional, default None) - dropdown populated at runtime from models/controlnet.
  • mask_mode (optional, default Ailmama - the schema's own typo for Alimama) - Ailmama / mask_black / mask_white / mask_gray.
  • latent_image - despite the name, this is typed IMAGE, not LATENT. Wire your source picture in directly; the node handles the VAE encode itself.
  • latent_mask (MASK) - your inpaint mask.
  • smoothness (FLOAT, 0–10, default 0) - mask edge softness.
  • strength (FLOAT, 0–10, default 1) - only meaningful in mode two, the ControlNet's strength.
  • start_percent / end_percent (0–1) - same, ControlNet timing.

Output: inpaint, an INPAINT_STACK object. Given it shares the same denoise-and-mask vocabulary, this looks built to feed into the pack's paint-aware sampler stage - most plausibly Stack_Ksampler_dual_paint - though the exact wiring is only confirmed by the pack's own example workflows.

Setting it up

For most jobs, start in mode one (leave control_net at None): pick low-noise for a detail fix, or expect to need high-noise if you're running Qwen Image Edit or Kontext for a bigger change. Only reach for mode two if you specifically have (and want) a dedicated inpainting ControlNet checkpoint, and match mask_mode to your base model exactly as listed above.

Install

Search "ComfyUI-Apt_Preset" in ComfyUI Manager and install, or clone by hand: cd ComfyUI/custom_nodes && git clone https://github.com/cardenluo/ComfyUI-Apt_Preset.git, then restart. The install.bat dependency installer is Windows-only - on Linux or a cloud box, read what it lists and pip-install those packages, or let ComfyUI Manager's "install missing nodes" flow handle it.

Troubleshooting

Blurry or hard-edged seams around your inpainted region usually trace back to smoothness being left at 0 - nudge it up if the boundary looks pasted-on.

Mode two is silently useless without the matching ControlNet checkpoint downloaded - the control_net dropdown only shows None until you've placed a compatible file in models/controlnet.

This pack has documented import failures independent of this specific node - a comfyui subreddit thread logs (IMPORT FAILED): ...ComfyUI-Apt_Preset. ComfyUI Manager's "install missing custom nodes" fixed it there, as did manually re-cloning the repo and restarting.

CategoryApt_Preset/stack/😺backup

Inputs (8)

NameTypeDefaultDescription
control_netoptCOMBONone1 options: None
mask_modeoptCOMBOAilmama4 options: Ailmama, mask_black, mask_white, mask_gray
latent_imageoptIMAGE
latent_maskoptMASK
smoothnessoptFLOAT0.000–10
strengthoptFLOAT1.0000–10
start_percentoptFLOAT0.0000–1
end_percentoptFLOAT1.0000–1

Outputs (1)

NameTypeDescription
inpaintINPAINT_STACK