Nodes/🐰 MaraScott Nodes/🐰 Set Inpainting Tile by mask - McInpainty [1/2] - v1 /i
ComfyUI Node

🐰 Set Inpainting Tile by mask - McInpainty [1/2] - v1 /i

Mask-based inpainting with a real sampler β€” the 'Set' half of McInpainty

By MaraScottΒ·Created 3 years agoΒ·Updated 10 months agoΒ· 179
🐰 Set Inpainting Tile by mask - McInpainty [1/2] - v1 /i
  • image
  • painted_image
  • mask
  • noise_image
  • model
  • clip
  • vae
  • ms_pipe
  • image_inpainted
  • image_noised
  • text_pos_image_inpainted
  • text_neg_image_inpainted
β—„inpaint_size1024β–Ί
β—„painted_mask_padding50β–Ί
β—„tile_blend_modenormalβ–Ί
β—„noise_blend51β–Ί
β—„tile_opacity100β–Ί
β—„model_diffdifftrueβ–Ί
β—„text_pos_imageβ€”β–Ί
β—„text_pos_inpaintβ€”β–Ί
β—„text_neg_inpaintβ€”β–Ί
β—„seed4β–Ί
β—„steps20β–Ί
β—„cfg8.0β–Ί
β—„sampler_nameβ–Ύβ–Ί
β—„basic_schedulerβ–Ύβ–Ί
β—„denoise0.59β–Ί

Full-image editing models took over most inpainting use cases, but there's one thing they still can't do: leave the pixels outside your mask bit-identical. If you need an object gone, a face fixed, or a region regenerated while everything else in the frame stays untouched, a mask-based sampler is still the tool - and that's exactly what Set Inpainting Tile by mask is. It's the first of the two-node McInpainty set (this one sets up and samples, the second, "Paste", stitches the result back).

The idea: you feed it your original image, a painted version of it (the region you edited by hand or in an image editor), a mask of that region, and a noise image. It crops the masked region, runs a proper KSampler pass on just that tile, and hands you a pipe plus the inpainted and noised tiles for the Paste node to composite back.

How it works

The node is essentially a self-contained mini inpainting workflow. It takes your mask region, pads it (painted_mask_padding), crops the tile, upscales it to the inpaint_size you chose (512 or 1024), then runs KSampler on the tile with your model, clip, vae, prompts and sampler settings. You get two prompts to play with: text_pos_image describes the whole original, and text_pos_inpaint adds what you want in the painted region - the node concatenates them for the final positive (text_pos_image_inpainted output). The model_diffdiff toggle applies a diff-diff trick so the tile matches the source image's colors instead of hallucinating its own palette - that's the "keep the background faithful" switch, and it's on by default.

You can also blend the result with the source using the LayerStyle-style blend settings (tile_blend_mode, tile_opacity, noise_blend), which is how you get soft, seamless fades rather than hard tile edges.

The inputs and outputs that matter

  • image, painted_image, mask, noise_image - the four required image inputs. Get these right and the rest is tuning.
  • inpaint_size - 512 or 1024. Higher means more detail budget for the fix, at VRAM cost.
  • painted_mask_padding - pixels of padding around the mask so the model has context to blend against. 50 is the default; increase if edges look cut.
  • denoise (default 0.59) - the big dial. For light fixes keep it 0.3–0.5; for actually replacing content push it up. Too high rewrites the masked region entirely and can clash with the source.
  • model, clip, vae, seed, steps, cfg, sampler_name, basic_scheduler - your standard sampler inputs, same as any KSampler.

Outputs: ms_pipe (the pipe the Paste node consumes), image_inpainted, image_noised, text_pos_image_inpainted, text_neg_image_inpainted.

Installing it

Part of the MaraScott pack: ComfyUI Manager β†’ search "MaraScott" β†’ Install β†’ restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/MaraScott/ComfyUI_MaraScott_Nodes

Then restart. The pack's requirements include opencv-python, numba, blend_modes (the tile blend modes live in LayerStyle-style code bundled here) and color-matcher (used for color-matching) - that's what this node actually leans on. The old transformers==4.37.2 pin is pack-wide; if you only want inpainting, be aware it comes along anyway.

Common issues

Color mismatch between the inpainted tile and the source is the classic pain - keep model_diffdiff on and pick a sensible tile_blend_mode (normal unless you know otherwise). Hard seams come from too little painted_mask_padding or a denoise too low to actually break the boundary. And remember this is the set half: until you add the Paste node downstream, you're looking at tiles, not a finished image. The README itself admits the McInpainty description is still in progress - the nodes work, the docs are thin, so test with a saved workflow.

Category🐰 MaraScott/Inpainting

Inputs (22)

NameTypeDefaultDescription
imageIMAGEβ€”
painted_imageIMAGEβ€”
maskMASKβ€”
noise_imageIMAGEβ€”
inpaint_sizeINT1024512–1024β€”
painted_mask_paddingINT500–100β€”
tile_blend_modeCOMBOnormal30 options: normal, dissolve, darken, multiply, color burn, linear burn, +24
noise_blendINT510–100β€”
tile_opacityINT1000–100β€”
modelMODELβ€”
model_diffdiffBOOLEANtrueβ€”
clipCLIPβ€”
vaeVAEβ€”
text_pos_imageSTRINGβ€”
text_pos_inpaintSTRINGβ€”
text_neg_inpaintSTRINGβ€”
seedINT40–18446744073709550000β€”
stepsINT201–10000β€”
cfgFLOAT8.00–100β€”
sampler_nameCOMBO34 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +28
basic_schedulerCOMBO9 options: normal, karras, exponential, sgm_uniform, simple, ddim_uniform, +3
denoiseFLOAT0.590–1β€”

Outputs (5)

NameTypeDescription
ms_pipeMS_INPAINTINGTILEBYMASK_PIPEβ€”
image_inpaintedIMAGEβ€”
image_noisedIMAGEβ€”
text_pos_image_inpaintedSTRINGβ€”
text_neg_image_inpaintedSTRINGβ€”