4.9 KiB
LanPaint
Unlock precise inpainting without additional training. LanPaint lets the model "think" through multiple iterations before denoising, aiming for seamless and accurate results. This is the official implementation of "Lanpaint: Training-Free Diffusion Inpainting with Exact and Fast Conditional Inference".
Features
- 🎨 Zero-Training Inpainting - Works immediately with ANY SD model, even custom models you've trained yourself
- 🛠️ Simple Integration - Same workflow as standard ComfyUI KSampler
- 🚀 Quality Enhancements - High quality and seamless inpainting
Example Results
Example 1 (LanPaint K Sampler)

View Workflow & Masks
Model Used in This Example
Example 2: (LanPaint K Sampler (Advanced))

View Workflow & Masks
Model Used in This Example
Example 3: (LanPaint K Sampler (Advanced))

View Workflow & Masks
Model Used in This Example
Each example includes:
- Original masked image
- Full ComfyUI workflow
Quickstart
- Install ComfyUI: Follow the official ComfyUI installation guide to set up ComfyUI on your system.
- Install ComfyUI-Manager: Add the ComfyUI-Manager for easy extension management.
- Install LanPaint Nodes:
- Via ComfyUI-Manager: Search for "LanPaint" in the manager and install it directly.
- Manually: Click "Install via Git URL" in ComfyUI-Manager and input the GitHub repository link:
Alternatively, clone this repository into the
https://github.com/scraed/LanPaint.gitComfyUI/custom_nodesfolder.
- Restart ComfyUI: Restart ComfyUI to load the LanPaint nodes.
Once installed, you'll find the LanPaint nodes under the "sampling" category in ComfyUI. Use them just like the default KSampler for high-quality inpainting!
Usage
Workflow Setup
Same as default ComfyUI KSampler - simply replace with LanPaint KSampler nodes. The inpainting workflow is the same as the SetLatentNoiseMask inpainting workflow.
Note
- LanPaint requires binary masks (values of 0 or 1) without opacity or smoothing. To ensure compatibility, set the mask's opacity and hardness to maximum in your mask editor. During inpainting, any mask with smoothing or gradients will automatically be converted to a binary mask.
- LanPaint relies heavily on your text prompts to guide inpainting - explicitly describe the content you want generated in the masked area. If results show artifacts or mismatched elements, counteract them with targeted negative prompts.
Basic Sampler
LanPaint KSampler
Simplified interface with recommended defaults:
- Steps: 50+ recommended
- LanPaint NumSteps: 1-10 (complexity of edits)
- Built-in parameter presets
Advanced Sampler
LanPaint KSampler (Advanced)
Full parameter control:
Key Parameters
| Parameter | Range | Description |
|---|---|---|
Steps |
0-100 | Total steps of diffusion sampling. Higher means better inpainting. Recommend 50. |
LanPaint_NumSteps |
0-20 | Reasoning iterations per denoising step ("thinking depth") |
LanPaint_Lambda |
0.1-50 | Content alignment strength (higher = stricter) |
LanPaint_cfg_BIG |
0-20 | CFG scale used when aligning masked and unmasked region (higher = better alignment). |
For detailed descriptions of each parameter, simply hover your mouse over the corresponding input field to view tooltips with additional information.
Usage Tips
- Start Simple - Begin with basic sampler and default values
- Increase Steps - 50-100 steps recommended for complex edits
- Tune Gradually - Adjust parameters in 10-20% increments
- Monitor Stability - If artifacts appear, increase Friction/Tamed
Citation
If you use LanPaint in your research or projects, please cite our work:
@misc{zheng2025lanpainttrainingfreediffusioninpainting,
title={Lanpaint: Training-Free Diffusion Inpainting with Exact and Fast Conditional Inference},
author={Candi Zheng and Yuan Lan and Yang Wang},
year={2025},
eprint={2502.03491},
archivePrefix={arXiv},
primaryClass={eess.IV},
url={https://arxiv.org/abs/2502.03491},
}