General Introduction
LanPaint is a high quality image restoration tool designed for Stable Diffusion models. Its best features areEnables any Stable Diffusion model to achieve accurate image restoration without additional training. With a simple installation, the user is able to work in the familiar ComfyUI Replace the default sampler in your workflow and get started quickly.LanPaint optimizes the restoration with multiple iterations for a natural and seamless restored image. It is suitable for repairing damaged photos, replacing image elements or improving the quality of your creations. This tool makes it easy to handle image editing tasks for both novice and professional users. It is currently open source on GitHub and has received a lot of attention from AI image processing enthusiasts.
Function List
- Image restoration without training: directly adapts to any Stable Diffusion model, including user-defined models.
- Simple Replacement Sampler: Replace the default KSampler node in ComfyUI, keeping the original workflow.
- High-quality restoration results: Generating new content through multiple iterations ensures that the restored area blends naturally with its surroundings.
- Flexible adjustment of parameters: support the adjustment of inference steps, alignment strength, etc., to adapt to different restoration needs.
- Supports multiple uses: can be used for content replacement, detail refinement, and even generating consistent roles.
Using Help
Installation process
LanPaint is very easy to install and is mainly integrated through ComfyUI. Below are the detailed steps:
- Installation via ComfyUI-Manager
- Open ComfyUI and go to ComfyUI-Manager.
- Type "LanPaint" in the search bar.
- Click the Install button and wait for the installation to complete.
- manual installation
- In ComfyUI, click "Install via Git URL".
- Enter LanPaint's GitHub address:
https://github.com/scraed/LanPaint.git
The - Click to confirm the installation.
- Alternatively, open a terminal and go to ComfyUI's
custom_nodes
folder, run the command:git clone https://github.com/scraed/LanPaint.git
- After the installation is complete, restart ComfyUI.
- Checking the installation
- After restarting, find the "sampling" category in ComfyUI's node menu.
- If you see LanPaint-related nodes (such as LanPaint KSampler), the installation was successful.
How to use
LanPaint's operation is based on ComfyUI's workflow. Here are the steps:
basic operation
- preliminary
- Ensure that the Stable Diffusion model is installed and loaded into the "Load Checkpoint" node of ComfyUI.
- Prepare an image to be repaired and upload it to the "Load Image" node.
- Creating a Repair Mask
- In image editing software (e.g. Photoshop), draw a mask for the area to be repaired.
- Masking requires a binary map (black and white, 0 or 1) with no transparency or blurred edges.
- Save the mask as a PNG and upload it to the "Load Image (Mask)" node in ComfyUI.
- Setting the LanPaint Node
- In the ComfyUI workflow, add the "LanPaint KSampler" node.
- Connect it to the Model, Image and Mask nodes, replacing the default KSampler.
- The default parameters will work, but can be adjusted as needed:
- LanPaint_stepsize: Controls the iteration step size, default 0.3, range 0-1.
- LanPaint_lambda: Adjusts the alignment strength of the masked area, default 1.
- LanPaint_cfg_Big: Enhancements to fix details, with default values depending on the model.
- Run Generation
- Click the "Queue Prompt" button in ComfyUI to start the generation.
- The generation time varies depending on the hardware and parameters and is usually slightly longer than the default fix.
Featured Function Operation
- Content replacement
- EXAMPLE: Replace the white shirt with a blue one.
- Mark the shirt area in the mask, upload the image and the mask.
- Run LanPaint by typing "blue shirt" at the prompt.
- The result produces a blue shirt and blends naturally with its surroundings.
- Damage Repair
- Example: repairing scratches on an old photograph.
- Cover the scratched area with a mask and upload it to ComfyUI.
- LanPaint automatically generates new content to fill in the damage without prompting for special words.
- Coherent role generation
- Example: generating multiple perspectives of the same character.
- Upload character images, copy multiple copies and adjust the angles to create a mask.
- Add "multiple views" to the prompt word and run to generate it.
caveat
- Masking Requirements: It must be a pure black and white binary image, avoiding gray or gradients.
- hardware requirement: Generating multiple images may take up more GPU memory, it is recommended to adjust the batch size according to the video memory.
- parameterization: Complex repair tasks can be increased in step size (e.g. 0.5) to improve results.
With these steps, users can easily get started with LanPaint and accomplish a variety of tasks from simple replacements to complex repairs.
application scenario
- Restoration of old photographs
Users can use LanPaint to repair scratches, smudges, or missing parts of old photos and bring precious memories back to life. - Creative Image Editing
Designers can use it to replace objects in an image, such as replacing a chair with a table or changing the color of a dress, to quickly implement creative ideas. - Perfection in artistic creation
Artists can use LanPaint to modify the details of their paintings, such as adjusting the background or adding new elements to enhance the integrity of their work. - Advertising Image Processing
Advertising teams can use it to adjust the product display image, such as changing backgrounds or props, to meet different marketing needs. - Video Frame Repair
Video editors can use LanPaint to repair keyframes, remove distractions or optimize picture details.
QA
- What is the difference between LanPaint and the default fix?
While the default repair usually preserves some of the original pixels, LanPaint generates the new content entirely, with more natural results for complex tasks. - Need to train the model?
No need, LanPaint adapts directly to any Stable Diffusion model right out of the box. - Why is the generation time slower than the default?
LanPaint uses multiple iterations to optimize the effect, so it takes a little longer than a single generation, but the quality is higher. - Can it be used on other platforms?
ComfyUI is currently the main support, other platforms need additional adaptations.