Inpaint
Inpaint without a separate KSampler
- image
- mask
- model
- clip
- vae
- positive_conditioning
- negative_conditioning
- ui_widget
- image
- image_list
Inpainting in stock ComfyUI is a small chore: you wire a VAE encode, a patch, a sampler, a decode, and a composite, and you hope the pieces line up. LF_Inpaint collapses that whole chain into one node. You hand it an image, a mask, a model, a CLIP and a VAE - it runs the diffusion pass and returns the inpainted image. If you've ever stared at a "paint out that power line / fix that face / remove that watermark" workflow and wished it were a single box, this is that box.
It sits squarely in the "mask-based inpainting" camp, and the knowledge base has a clear-headed take on why that still matters in the era of instruction-edit models: an edit model regenerates everything and drifts, while a mask inpainter leaves the unmasked pixels bit-identical. If you need exactly-one-region changed and nothing else moved, this is the tool.
How it works
The node runs the diffusion itself - model, clip, vae go straight in, no separate KSampler, no latent encode/decode nodes. Required basics: mask (1 = inpaint, per-image masks/batches supported), steps (default 16), cfg (default 7), and the critical one, denoise_percentage. It's 0–100 rather than the 0–1 denoise you usually see: 40% (the default) means a moderate rewrite of the masked area, ~10–25% for subtle fixes, 80%+ for full regeneration inside the mask.
Two ways to drive the generation: either positive_prompt / negative_prompt strings (simplest), or pre-built positive_conditioning / negative_conditioning from a CLIP Text Encode node if you want conditioning the rest of your graph already built. You can also swap sampler (44 options, default dpmpp_2m) and scheduler (default karras).
The gotcha worth knowing
upsample_target defaults to 1024. If your input is smaller, the image and mask get upscaled to ~1024 on the long side before inpainting and pasted back down afterward. That's actually the intended detail-boosting behavior - small crops get a bigger generation budget - but it's easy to mistake for the node resizing your image. Set it to 0 if you want no upsampling at all.
Outputs
image / image_list - the inpainted result. Compare widget shows before/after. That's the entire interface.
Installing it
lf-nodes installs as one pack:
cd ComfyUI/custom_nodes
git clone https://github.com/lucafoscili/lf-nodes
then restart ComfyUI (or ComfyUI Manager → "LF Nodes"). No extra model - it runs whatever checkpoint your graph already loads.
Troubleshooting
- Too much change - the 40% default is a rewrite. For a stray speck or a small flaw, drop
denoise_percentageto 10–20 first. - Seams at the mask edge - feather the mask before it reaches this node (or use the advanced variant, which feathers internally).
- Squashed output - almost certainly
upsample_targetdoing its job on a small input. Set it to 0 and try again.
Inputs (16)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Base image. | |
| mask | MASK | Regions to inpaint (1=inpaint). Supports a single mask or a per-image mask list/batch. | |
| model | MODEL | Diffusion model. | |
| clip | CLIP | CLIP text encoder. | |
| vae | VAE | VAE for encode/decode. | |
| steps | INT | 161–10000 | Number of diffusion steps to use. |
| denoise_percentage | FLOAT | 400–100 | Percentage of denoising to apply. |
| cfg | FLOAT | 7.00–100 | Classifier-free guidance scale. |
| positive_promptopt | STRING | The prompt to guide the inpainting process. | |
| negative_promptopt | STRING | The prompt to discourage certain elements in the inpainting process. | |
| positive_conditioningopt | CONDITIONING | Conditioning inputs to guide the inpainting process. | |
| negative_conditioningopt | CONDITIONING | Conditioning inputs to discourage certain elements in the inpainting process. | |
| upsample_targetopt | INT | 10240–16384 | If greater than 0, the image and mask will be upsampled to this size before inpainting. |
| sampleropt | COMBO | dpmpp_2m | The sampler to use for the diffusion process. |
| scheduleropt | COMBO | karras | The scheduler to use for the diffusion process. |
| ui_widgetopt | LF_COMPARE | [object Object] | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | Image tensor with inpainting effect applied. |
| image_list | IMAGE | List of image tensors with inpainting effect applied. |