π° Set Inpainting Tile by mask - McInpainty [1/2] - v1 /i
Mask-based inpainting with a real sampler β the 'Set' half of McInpainty
- image
- painted_image
- mask
- noise_image
- model
- clip
- vae
- ms_pipe
- image_inpainted
- image_noised
- text_pos_image_inpainted
- text_neg_image_inpainted
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.
Inputs (22)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | β | |
| painted_image | IMAGE | β | |
| mask | MASK | β | |
| noise_image | IMAGE | β | |
| inpaint_size | INT | 1024512β1024 | β |
| painted_mask_padding | INT | 500β100 | β |
| tile_blend_mode | COMBO | normal | 30 options: normal, dissolve, darken, multiply, color burn, linear burn, +24 |
| noise_blend | INT | 510β100 | β |
| tile_opacity | INT | 1000β100 | β |
| model | MODEL | β | |
| model_diffdiff | BOOLEAN | true | β |
| clip | CLIP | β | |
| vae | VAE | β | |
| text_pos_image | STRING | β | |
| text_pos_inpaint | STRING | β | |
| text_neg_inpaint | STRING | β | |
| seed | INT | 40β18446744073709550000 | β |
| steps | INT | 201β10000 | β |
| cfg | FLOAT | 8.00β100 | β |
| sampler_name | COMBO | 34 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +28 | |
| basic_scheduler | COMBO | 9 options: normal, karras, exponential, sgm_uniform, simple, ddim_uniform, +3 | |
| denoise | FLOAT | 0.590β1 | β |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| ms_pipe | MS_INPAINTINGTILEBYMASK_PIPE | β |
| image_inpainted | IMAGE | β |
| image_noised | IMAGE | β |
| text_pos_image_inpainted | STRING | β |
| text_neg_image_inpainted | STRING | β |