Nodes/ComfyUI Impact Pack/MaskDetailer (pipe)
ComfyUI Node Runs on cloud

MaskDetailer (pipe)

Detailer-quality inpainting on a mask you draw yourself

By ltdrdata·Created 3 years ago·Updated 4 months ago· 3,242
MaskDetailer (pipe)
  • image
  • mask
  • basic_pipe
  • refiner_basic_pipe_opt
  • detailer_hook
  • scheduler_func_opt
  • image
  • cropped_refined
  • cropped_enhanced_alpha
  • basic_pipe
  • refiner_basic_pipe_opt
guide_size512
guide_size_fortrue
max_size1024
mask_modetrue
seed0
steps20
cfg8.00
sampler_name
scheduler
denoise0.50
feather5
crop_factor3.0
drop_size10
refiner_ratio0.20
batch_size1
cycle1
inpaint_modelfalse
noise_mask_feather20
bbox_fillfalse
contour_filltrue

MaskDetailer (pipe) is the Impact Pack's answer to "I already know where I want to fix - I just want it done at proper resolution." It's a simple inpaint node that runs the pack's crop-resample-paste detailer on a mask you provide, instead of one a YOLO detector found. No detection step, no SEGS - you hand it an image and a mask, and it refines the masked region the same way FaceDetailer refines a face.

That distinction is the whole point. Every other detailer in the pack starts by finding the region. This one skips that. When you've painted a mask in a Preview Bridge, generated one with CLIPSeg, or built it out of mask operations, MaskDetailer is how you get the detailer's only-the-region, full-resolution treatment without pretending a detector needs to be involved. Think of it as "inpaint this spot, but crop and upscale it first so the detail actually lands."

How it works

You give it an image, a mask, and a BASIC_PIPE (model, clip, vae, positive, negative bundled together). It crops the masked area with padding, scales it toward guide_size, runs a sampling pass on that crop, and composites it back under a feathered mask - the identical detailer loop, driven by your mask rather than a detection. Because it's a masked regional resample, all the ordinary inpainting intuition applies: low denoise for a touch-up, higher for a rework, and composite-only-the-region so the rest of the frame never round-trips the VAE.

The inputs and outputs that matter

  • image, mask (required) - the picture and the region to refine. The mask is yours to supply.
  • basic_pipe (required) - model/clip/vae/positive/negative in one bundle, built with ToBasicPipe.
  • guide_size (default 512) - the size the masked crop is scaled to before resampling. Where the detail comes from.
  • denoise (default 0.5) - how far the region departs from the original. 0.3–0.4 to clean up, higher to genuinely change what's there.
  • mask_mode (default true) - refine inside the mask (the normal case).
  • feather (default 5) and crop_factor (default 3) - paste-edge softness and how much surrounding context the crop keeps.
  • contour_fill (default true) - fills the interior of a hollow/outline mask so the whole enclosed area gets treated, not just the drawn line.
  • cycle (default 1) and batch_size (default 1) - refine passes, and how many candidate results to sample per region.

Optional inpaint_model, refiner_basic_pipe_opt (for an SDXL refiner), and detailer_hook cover advanced setups. Outputs: image (the fixed frame), cropped_refined and cropped_enhanced_alpha (the crop for inspection), and the basic_pipe passed through for chaining.

How to install it

Install the pack via ComfyUI Manager (search ComfyUI Impact Pack, install, restart), or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack comfyui-impact-pack
cd comfyui-impact-pack
python -m pip install -r requirements.txt   # ComfyUI's python; python_embeded on portable

then restart. Unlike the detector-driven detailers, this one needs no Subpack and no detection models - you're bringing the mask, so there's nothing to detect. Linux still wants libgl1-mesa-glx and libglib2.0-0 for OpenCV.

Common issues & troubleshooting

The fix bled outside where I painted. Check crop_factor and feather - a large crop factor pulls in a lot of context, and heavy feather softens the mask edge. Also confirm contour_fill is behaving: if your mask is an outline rather than a filled shape, contour_fill true fills it in, which may cover more than you meant.

The masked area barely changed. denoise too low, or the mask is tiny relative to guide_size so there's little to work with. Raise denoise toward 0.5–0.6 for a real change.

Grey or colour-shifted patch. The usual VAE-mismatch culprit - make sure the VAE in your basic_pipe matches the model. This is the same encode/decode colour shift people hit with any inpaint pass.

Why not just use a normal inpaint node? You can - but a plain inpaint samples the masked area at whatever resolution it sits at in the frame. MaskDetailer crops and upscales it first, so a small region gets a full generation budget. That's the difference between "fixed" and "fixed and actually detailed."

CategoryImpactPack/Detailer

Inputs (26)

NameTypeDefaultDescription
imageIMAGE
maskMASK
basic_pipeBASIC_PIPE
guide_sizeFLOAT51264–16384
guide_size_forBOOLEANtrue
max_sizeFLOAT102464–16384
mask_modeBOOLEANtrue
seedINT00–18446744073709550000
stepsINT201–10000
cfgFLOAT8.000–100
sampler_nameCOMBO44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38
schedulerCOMBO17 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +11
denoiseFLOAT0.500.0001–1
featherINT50–100
crop_factorFLOAT3.01–10
drop_sizeINT101–16384
refiner_ratioFLOAT0.200–1
batch_sizeINT11–100
cycleINT11–10
refiner_basic_pipe_optoptBASIC_PIPE
detailer_hookoptDETAILER_HOOK
inpaint_modeloptBOOLEANfalse
noise_mask_featheroptINT200–100
bbox_filloptBOOLEANfalse
contour_filloptBOOLEANtrue
scheduler_func_optoptSCHEDULER_FUNC

Outputs (5)

NameTypeDescription
imageIMAGE
cropped_refinedIMAGE
cropped_enhanced_alphaIMAGE
basic_pipeBASIC_PIPE
refiner_basic_pipe_optBASIC_PIPE