LanPaint

scraedGPL-3.0活跃维护

面向各类 Stable Diffusion 模型的高质量免训练图像修复方案,可作为 ComfyUI 自定义节点直接接入工作流,无需额外训练即可完成局部重绘。

High quality training free inpaint for every stable diffusion model. Supports ComfyUI

2.2.0发布于 2026-09-28 12:35 UTC1,481star57fork同步于 2026-11-07 07:30 UTC

怎么上手

由 README 提炼,执行前请确认
通过 ComfyUI-Manager 搜索 LanPaint 安装,或在 ComfyUI-Manager 中选 Install via Git URL 输入 https://github.com/scraed/LanPaint.git
硬件要求按 README 说明

README 未说明具体显存要求;视频重绘处理时间随帧数显著增加,建议控制在 40 帧以内以保证稳定

支持 Apple Silicon
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

免训练的通用局部重绘采样器,让任意扩散模型通过多步「思考」提升修补质量

面向各类 Stable Diffusion 模型的高质量免训练图像修复方案,可作为 ComfyUI 自定义节点直接接入工作流,无需额外训练即可完成局部重绘。

核心能力

  • 以多步迭代「思考」替代微调,实现免训练重绘
  • 支持重绘、外扩、掩码局部编辑与物体替换
  • 兼容 ComfyUI,节点位于 sampling 分类下
  • 支持 Wan 2.2 视频重绘/外扩与 MiniMax H3 音视频联合重绘
  • 适配 Qwen-Image 2.1、Z-Image、Ideogram4 等多种模型

容易踩的坑

需先安装 ComfyUI(版本需高于 0.3.11)并重启才能加载节点;示例工作流需自行下载对应模型;视频重绘帧数过多时耗时剧增且效果可能不稳定

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本2.2.0
  1. 2.2.0最新正式版2026-09-28 · 2026-09-28 12:35 UTC

    Supports Qwen 2.1 Fix minimax h3 bug

  2. v2.1.02026-08-12 · 2026-08-12 09:31 UTC
    查看更新说明

    What's new

    • Significantly accelerated LanPaint with a new schedule mechanism — the inner step size stays constant and the inner-step count ramps down with the remaining noise, so the tail of the schedule no longer wastes iterations on frozen dynamics.
    • Fix bugs for MiniMax H3 on the latest ComfyUI (0.31+).

    Changes

    • Retired hyperparameters: Beta, Friction, EarlyStop, InnerThreshold, InnerPatience, and MinStepFrac are no longer exposed on the sampler nodes; their fixed defaults are used. Old workflows keep working — a value sanitizer falls back to defaults on invalid inputs, and the frontend migrates saved workflows with key-based widget mapping.
    • New LanPaint_MinStepFrac schedule control (default 1.0): constant step size with a linearly ramped inner-step count.
    • Video mask union reworked: the mask resample follows the painted region's motion through the video.
    • Example_29 updated with the latest MiniMax H3 output; workflow JSON re-exported.
  3. 2.0.02026-08-09 · 2026-08-09 15:53 UTC
    查看更新说明
    • Minimax H3 support with new video and audio pipeline
    • compatibility fixes with latest comfy
  4. 1.5.52026-06-27 · 2026-06-27 15:44 UTC
    查看更新说明
    • support Krea2
    • fix Flux Klein reference problem
  5. 1.5.42026-06-27 · 2026-06-27 03:57 UTC
    查看更新说明

    Ideogram 4 support Bug fix

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    LanPaint: Universal Inpainting Sampler with "Think Mode"

    TMLR PDF Python Benchmark ComfyUI Extension Hugging Face Blog GitHub stars Discord

    Universally applicable inpainting ability for every model. LanPaint sampler lets the model "think" through multiple iterations before denoising, enabling you to invest more computation time for superior inpainting quality.

    What LanPaint Enables

    • Training-free image inpainting
    • Outpainting and generative fill
    • Mask-constrained local image editing
    • Object / region replacement with text guidance
    • Character-consistent local generation
    • Video inpainting and local video editing
    • Video + audio masked generation

    Research & Benchmark

    LanPaint is a training-free partial conditional sampler that enables mask-constrained inpainting and local editing with pretrained diffusion and rectified-flow models, without fine-tuning or backpropagation.

    Citation

    @article{
    zheng2025lanpaint,
    title={LanPaint: Training-Free Diffusion Inpainting with Asymptotically Exact and Fast Conditional Sampling},
    author={Candi Zheng and Yuan Lan and Yang Wang},
    journal={Transactions on Machine Learning Research},
    issn={2835-8856},
    year={2025},
    url={https://openreview.net/forum?id=JPC8JyOUSW}
    }
    

    🎉 NEW 2026: Join our discord!

    Join our Discord to share experiences, discuss features, and explore future development.

    v2.1.0 significantly accelerates LanPaint with a new schedule mechanism and fixes MiniMax H3 support on the latest ComfyUI. If your inpainting results have wierd (glowing / broken) mask boundary, check this issue.

    🎨 NEW: LanPaint now supports Qwen-Image 2.1 - transparency, and masked image editing!

    Qwen 2.1 image edit: the canvas, the mask, the second reference and the result

    Qwen 2.1's image edit model now works under a LanPaint mask: tell it what to change, paint over the part you want it to touch, and only that part changes. Hand it a second picture to borrow from if you want one. Check our latest Qwen Image 2.1 Image Edit Example.

    Qwen 2.1 before / masked / after

    And if your picture carries transparency, it gets inpainted too - the rebuilt part comes back with a new outline, not just new colours. Check our latest Qwen Image 2.1 Example.

    🎬 NEW: LanPaint now supports MiniMax H3 video + audio inpainting!

    Masked Input (paint in the editor)Mask (visible overlay)Inpainted Result
    Masked VideoMask OverlayInpainted Video

    Check our latest MiniMax H3 Example: paint per-frame video masks and audio intervals in one editor, inpaint video + audio in a single pass, and export the masks into the video file itself.

    🎬 NEW: LanPaint now supports inpainting and outpainting based on Z-Image!

    OriginalMaskedInpainted
    Original Z-imageMasked Z-imageInpainted Z-image

    🎬 NEW: LanPaint now supports Z-Image-Base too!

    OriginalMaskedInpainted
    Original Z-image-baseMasked Z-image-baseInpainted Z-image-base

    🎬 NEW: LanPaint now supports video inpainting and outpainting based on Wan 2.2!

    Original VideoMask (edit T-shirt text)Inpainted Result
    OriginalMaskResult

    Video Inpainting Example: 81 frames with temporal consistency

    🎬 NEW: LanPaint now supports Anima!

    OriginalMaskedInpainted
    Original AnimaMasked AnimaInpainted Anima

    🎬 NEW: LanPaint now supports Ideogram4!

    OriginalMaskedInpainted
    Original Ideogram4Masked Ideogram4Inpainted Ideogram4

    🎬 NEW: LanPaint now supports Krea2!

    OriginalMaskedInpainted
    Original Krea2Masked Krea2Inpainted Krea2

    Check our latest Krea2 Example, Ideogram4 Example, Anima Example, Wan 2.2 Video Examples, Wan 2.2 Image Examples, and Qwen Image Edit 2509 support.

    Table of Contents

    Features

    • Universal Compatibility – Works instantly with almost any model (Ideogram4, Krea2, Z-image, Z-image-base, Hunyuan, Wan 2.2, Qwen Image 2.1/Image/Edit, Anima, HiDream, SD 3.5, Flux-series, SDXL, SD 1.5 or custom LoRAs) and ControlNet.
      Inpainting Result 13
    • No Training Needed – Works out of the box with your existing model.
    • Easy to Use – Same workflow as standard ComfyUI KSampler.
    • Flexible Masking – Supports any mask shape, size, or position for inpainting/outpainting.
    • No Workarounds – Generates 100% new content (no blending or smoothing) without relying on partial denoising.
    • Beyond Inpainting – You can even use it as a simple way to generate consistent characters.
    • Video Mask Editor – Paint per-frame inpainting masks directly on a video inside ComfyUI (LanPaint_VideoMaskEditor): pick the video file, open the editor, paint masks on keyframes, and the masks in between are interpolated automatically with a live preview. Mask = 1 regenerates, 0 keeps.
    • MiniMax H3 Video + Audio Inpainting – Inpaint video and audio in one pass: paint per-frame video masks and audio intervals in the same editor, encode both streams into one nested latent (LanPaint_AVEncode), sample, then LanPaint_AVDecode merges the inpainted video/audio back into the original with a mask-blended boundary, preserving the source fps and bit depth.
    • Masks Live in the Video – The editor can export the painted masks into the video file itself (mp4 metadata, via a new "masked" copy - the original is never modified). Share that single mp4 and the recipient gets the masks back automatically when they load it.

    Warning: LanPaint has degraded performance on distillation models, such as Flux.dev, due to a similar issue with LORA training. Please use low flux guidance (1.0-2.0) to mitigate this issue.

    Quickstart

    1. Install ComfyUI: Follow the official ComfyUI installation guide to set up ComfyUI on your system. Or ensure your ComfyUI version > 0.3.11.
    2. Install ComfyUI-Manager: Add the ComfyUI-Manager for easy extension management.
    3. 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:
        https://github.com/scraed/LanPaint.git
        
        Alternatively, clone this repository into the ComfyUI/custom_nodes folder.
    4. 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!

    How to Use Examples:

    1. Navigate to the example folder (i.e example_1), download all pictures.
    2. Drag InPainted_Drag_Me_to_ComfyUI.png into ComfyUI to load the workflow.
    3. Download the required model (i.e clicking Model Used in This Example).
    4. Load the model in ComfyUI.
    5. Upload Masked_Load_Me_in_Loader.png to the "Load image" node in the "Mask image for inpainting" group (second from left), or the Prepare Image node.
    6. Queue the task, you will get inpainted results from LanPaint. Some example also gives you inpainted results from the following methods for comparison:

    Video Examples

    LanPaint now supports video inpainting with Wan 2.2, enabling you to seamlessly inpaint masked regions across video frames while maintaining temporal consistency.

    Note: LanPaint supports video inpainting for longer sequences (e.g., 81 frames), but processing time increases significantly (please check the Resource Consumption section for details) and performance may become unstable. For optimal results and stability, we recommend limiting video inpainting to 40 frames or fewer.

    Wan 2.2 Video Inpainting

    Example: Wan2.2 t2v 14B, 480p video (11:6), 40 frames, LanPaint K Sampler, 2 steps of thinking

    Original VideoMask (Add a white hat)Inpainted Result
    Original VideoMaskInpainted Result

    View Workflow & Masks

    You need to follow the ComfyUI version of Wan2.2 T2V workflow to download and install the T2V model.

    Wan 2.2 5B Video Inpainting

    Similar to Wan 2.2 14B with slightly different workflow. View Workflow & Masks

    Wan 2.2 Video Outpainting

    Extend your videos beyond their original boundaries with LanPaint's video outpainting capability based on Wan 2.2. This feature allows you to expand the canvas of your videos while maintaining coherent motion and context.

    Example: Wan2.2 t2v 14B, 480p video (1:1 outpaint to 11:6), 40 frames, LanPaint K Sampler, 2 steps of thinking

    Original VideoMask (Expand to 880x480)Outpainted Result
    Original VideoMaskOutpainted Result

    View Workflow & Masks

    You need to follow the ComfyUI version of Wan2.2 T2V workflow to download and install the T2V model.

    MiniMax H3 Video + Audio Inpainting (AV pipeline)

    LanPaint's AV pipeline inpaints video and audio together with the MiniMax H3 model. Paint both masks in one editor session, run a single sampler pass on the nested AV latent, and get back a merged video at the original fps and bit depth.

    Example: MiniMax H3, 864x480, 124 frames, LanPaint Sampler Custom (Advanced)

    Masked Input (paint in the editor)Mask (visible overlay)Inpainted Result
    Masked VideoMask OverlayInpainted Video

    LanPaint VideoMaskEditor

    View Workflow & Masks · Workflow JSON

    How it works:

    1. LanPaint_VideoMaskEditor – pick the video, open the editor, paint per-frame video masks on keyframes (SDF-interpolated in between) and drag audio intervals on the waveform. Mask = 1 regenerates, 0 keeps.
    2. LanPaint_AVEncode – encodes the video frames and the audio track into one nested latent with the masks attached.
    3. Run the sampler as usual (the audio stream runs on its own shifted sigma schedule).
    4. LanPaint_AVDecode – decodes the nested latent, merges the inpainted video with the original (mask-blended boundary) and the inpainted audio inside the masked intervals (with a short crossfade), and writes the result at the original fps and bit depth.

    Export masks into the video: the editor's Export mask video button remuxes a new <name>_masked.mp4 copy with the masks embedded in the file metadata (the original file is never modified). Open that file in the editor later - or share it with someone - and the masks are restored automatically.

    Download the models from MiniMax H3 on Hugging Face and follow the ComfyUI MiniMax H3 docs.

    Resource Consumption

    Test Platform: All tests were conducted on an NVIDIA RTX Pro 6000. Model Used: wan2.2_t2v_low_noise_14B_fp8_scaled.safetensors and wan2.2_t2v_high_noise_14B_fp8_scaled.safetensors. Processing Steps: 20 sampling steps x 2 (LanPaint steps of thinking).

    Note: Vram is required by the model, not LanPaint. To further reduce VRAM requirements, we recommend generating less frames and loading CLIP on CPU.

    Image Examples

    Example Anima: InPaint(LanPaint K Sampler, 5 steps of thinking)

    We are excited to announce that LanPaint now supports inpainting with the Anima text-to-image model.

    OriginalMaskedInpainted
    Original AnimaMasked AnimaInpainted Anima

    View Workflow & Masks

    Model Used in This Example

    Example Ideogram4: InPaint(LanPaint Custom Sampler Advanced, 5 steps of thinking)

    We are excited to announce that LanPaint now supports inpainting with the Ideogram4 text-to-image model.

    OriginalMaskedInpainted
    Original Ideogram4Masked Ideogram4Inpainted Ideogram4

    View Workflow & Masks

    Model Used in This Example

    Example Hunyuan T2I: InPaint(LanPaint K Sampler, 5 steps of thinking)

    We are excited to announce that LanPaint now supports inpainting with Hunyuan text to image generation.

    View Workflow & Masks

    You need to follow the ComfyUI version of Hunyuan workflow to download and install the model.

    Example Wan2.2: InPaint(LanPaint K Sampler, 5 steps of thinking)

    We are excited to announce that LanPaint now supports Wan2.2 text to image generation with Wan2.2 T2V model.

    Inpainting Result 45
    View Workflow & Masks

    You need to follow the ComfyUI version of Wan2.2 T2V workflow to download and install the T2V model.

    Example Z-image: InPaint(LanPaint K Sampler, 5 steps of thinking)

    LanPaint also supports inpainting with the Z-image text-to-image model.

    OriginalMaskedInpainted
    Original Z-imageMasked Z-imageInpainted Z-image

    View Workflow & Masks

    OriginalMaskedOutpainted
    Original Z-image OutpaintMasked Z-image OutpaintOutpainted Z-image

    View Outpaint Workflow & Masks

    You can download the Z-image model for ComfyUI from Z-image.

    Example Z-image-base: InPaint(LanPaint K Sampler, 3 steps of thinking)

    LanPaint also supports inpainting with the Z-image-base model.

    Warning (stability): Z-image-base can easily diverge with LanPaint. Start with small LanPaint_StepSize and fewer thinking iterations (lower LanPaint_NumSteps) and increase gradually only if stable.

    OriginalMaskedInpainted
    Original Z-image-baseMasked Z-image-baseInpainted Z-image-base

    View Workflow & Masks

    Workflow template (JSON): Z_image_base_Inpaint.json

    Example Krea2: InPaint(LanPaint K Sampler, 3 steps of thinking)

    We are excited to announce that LanPaint now supports inpainting with the Krea2 Turbo text-to-image model.

    OriginalMaskedInpainted
    Original Krea2Masked Krea2Inpainted Krea2

    View Workflow & Masks

    Model Used in This Example

    Example Wan2.2: Partial InPaint(LanPaint K Sampler, 5 steps of thinking)

    Sometimes we don't want to inpaint completely new content, but rather let the inpainted image reference the original image. One option to achieve this is to inpaint with an edit model like Qwen Image Edit. Another option is to perform a partial inpaint: allowing the diffusion process to start at some middle steps rather than from 0.

    Inpainting Result 46
    View Workflow & Masks

    You need to follow the ComfyUI version of Wan2.2 T2V workflow to download and install the T2V model.

    Example Qwen Edit 2509: InPaint

    Check our latest updated Mased Qwen Edit Workflow for Qwen Image Edit 2509. Download the model at Qwen Image Edit 2509 Comfy. This workflow also supports Qwen Image Edit 2511.

    Qwen Result 3

    Example Qwen Edit 2508: InPaint

    Qwen Result 2 Check Mased Qwen Edit Workflow. You need to follow the ComfyUI version of Qwen Image Edit workflow to download and install the model.

    Example Qwen Image 2.1 Image Edit: Masked InPaint(LanPaint K Sampler, 5 steps of thinking)

    Qwen-Image 2.1's image edit model now works under a LanPaint mask: write what you want changed, paint over the part it should touch, and only that part changes - everything else, transparency included, comes back exactly as it was. In this example a second picture supplies the material for the earcups, and the headband and stitching stay as they are. Workflow and images are in examples/Example_32; drag InPainted_Drag_Me_to_ComfyUI.png into ComfyUI to load it. Use your own pictures with the official Qwen Image 2.1 Image Edit template.

    Qwen 2.1 image edit: canvas, mask, material, result View Workflow & Masks · Workflow JSON

    Example Qwen Image 2.1: InPaint with Transparency(LanPaint K Sampler, 5 steps of thinking)

    Qwen-Image 2.1 inpaints a picture's transparency along with its pixels, so the rebuilt part can come back with a new outline instead of merely new colours - here the boot's sole is replaced and the silhouette grows with it. Workflow and images are in examples/Example_31; drag InPainted_Drag_Me_to_ComfyUI.png into ComfyUI to load it.

    Qwen 2.1: original, mask, result View Workflow & Masks · Workflow JSON

    Example Qwen Image: InPaint(LanPaint K Sampler, 5 steps of thinking)

    Inpainting Result 14
    View Workflow & Masks

    You need to follow the ComfyUI version of Qwen Image workflow to download and install the model.

    The following examples utilize a random seed of 0 to generate a batch of 4 images for variance demonstration and fair comparison. (Note: Generating 4 images may exceed your GPU memory; please adjust the batch size as necessary.)

    Qwen Result 1 Also check Qwen Inpaint Workflow and Qwen Outpaint Workflow. You need to follow the ComfyUI version of Qwen Image workflow to download and install the model.

    Example HiDream: InPaint (LanPaint K Sampler, 5 steps of thinking)

    Inpainting Result 8
    View Workflow & Masks

    You need to follow the ComfyUI version of HiDream workflow to download and install the model.

    Example HiDream: OutPaint(LanPaint K Sampler, 5 steps of thinking)

    Inpainting Result 8
    View Workflow & Masks

    You need to follow the ComfyUI version of HiDream workflow to download and install the model. Thanks Amazon90 for providing this example.

    Example SD 3.5: InPaint(LanPaint K Sampler, 5 steps of thinking)

    Inpainting Result 8
    View Workflow & Masks

    You need to follow the ComfyUI version of SD 3.5 workflow to download and install the model.

    Example Flux.2.Dev: InPaint(LanPaint K Sampler, 5 steps of thinking)

    OriginalMaskedInpainted
    Original Flux.2.DevMasked Flux.2.DevInpainted Flux.2.Dev

    View Workflow & Masks

    Model Used in This Example

    (Note: Prompt First mode is disabled on Flux.2.Dev. As it does not use CFG guidance.)

    Example Flux 2 klein: InPaint(LanPaint K Sampler, 2 steps of thinking)

    OriginalMaskedInpainted
    Original Flux 2 kleinMasked Flux 2 kleinInpainted Flux 2 klein

    View Workflow & Masks

    Model Used in This Example. If you have quality problem on Comfy 0.11 and 0.12, check this issue.

    Example Flux: InPaint(LanPaint K Sampler, 5 steps of thinking)

    Inpainting Result 7
    View Workflow & Masks Model Used in This Example (Note: Prompt First mode is disabled on Flux. As it does not use CFG guidance.)

    Example SDXL 0: Character Consistency (Side View Generation) (LanPaint K Sampler, 5 steps of thinking)

    Inpainting Result 6
    View Workflow & Masks Model Used in This Example

    (Tricks 1: You can emphasize the character by copy it's image multiple times with Photoshop. Here I have made one extra copy.)

    (Tricks 2: Use prompts like multiple views, multiple angles, clone, turnaround. Use LanPaint's Prompt first mode (does not support Flux))

    (Tricks 3: Remeber LanPaint can in-paint: Mask non-consistent regions and try again!)

    Example SDXL 1: Basket to Basket Ball (LanPaint K Sampler, 2 steps of thinking).

    Inpainting Result 1
    View Workflow & Masks Model Used in This Example

    Example SDXL 2: White Shirt to Blue Shirt (LanPaint K Sampler, 5 steps of thinking)

    Inpainting Result 2
    View Workflow & Masks Model Used in This Example

    Example SDXL 3: Smile to Sad (LanPaint K Sampler, 5 steps of thinking)

    Inpainting Result 3
    View Workflow & Masks Model Used in This Example

    Example SDXL 4: Damage Restoration (LanPaint K Sampler, 5 steps of thinking)

    Inpainting Result 4
    View Workflow & Masks Model Used in This Example

    Example SDXL 5: Huge Damage Restoration (LanPaint K Sampler, 20 steps of thinking)

    Inpainting Result 5
    View Workflow & Masks Model Used in This Example

    Check more for use cases like inpaint on fine tuned models and face swapping, thanks to Amazon90.

    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

    Samplers

    • LanPaint KSampler: The most basic and easy to use sampler for inpainting.
    • LanPaint KSampler (Advanced): Full control of all parameters.

    LanPaint KSampler

    Simplified interface with recommended defaults:

    • Steps: 20 - 50. More steps will give more "thinking" and better results.
    • LanPaint NumSteps: The turns of thinking before denoising. Recommend 5 for most of tasks ( which means 5 times slower than sampling without thinking). Use 10 for more challenging tasks.
    • LanPaint Prompt mode: Image First mode and Prompt First mode. Image First mode focuses on the image, inpaint based on image context (maybe ignore prompt), while Prompt First mode focuses more on the prompt. Use Prompt First mode for tasks like character consistency. (Technically, it Prompt First mode change CFG scale to negative value in the BIG score to emphasis prompt, which will costs image quality.)

    LanPaint KSampler (Advanced)

    Full parameter control: Key Parameters

    ParameterRangeDescription
    Steps0-100Total steps of diffusion sampling. Higher means better inpainting. Recommend 20-50.
    LanPaint_NumSteps0-20Reasoning iterations per denoising step ("thinking depth"). Easy task: 2-5. Hard task: 5-10
    LanPaint_Lambda0.1-50Content alignment strength (higher = stricter). Recommend 4.0 - 10.0
    LanPaint_StepSize0.1-1.0The StepSize of each thinking step. Recommend 0.1-0.5.
    LanPaint_Beta0.1-2.0The StepSize ratio between masked / unmasked region. Small value can compensate high lambda values. Recommend 1.0
    LanPaint_Friction0.0-100.0The friction of Langevin dynamics. Higher means more slow but stable, lower means fast but unstable. Recommend 10.0 - 20.0
    LanPaint_EarlyStop0-10Stop LanPaint iteration before the final sampling step. Helps to remove artifacts in some cases. Recommend 1-5
    LanPaint_PromptModeImage First / Prompt FirstImage First mode focuses on the image context, maybe ignore prompt. Prompt First mode focuses more on the prompt.

    For detailed descriptions of each parameter, simply hover your mouse over the corresponding input field to view tooltips with additional information.

    LanPaint Mask Blend

    This node blends the original image with the inpainted image based on the mask. It is useful if you want the unmasked region to match the original image pixel perfectly.

    LanPaint KSampler (Advanced) Tuning Guide

    For challenging inpainting tasks:

    1️⃣ Boost Quality Increase total number of sampling steps (very important!), LanPaint_NumSteps (thinking iterations) or LanPaint_Lambda if the inpainted result does not meet your expectations.

    2️⃣ Boost Speed Decrease LanPaint_NumSteps to accelerate generation! If you want better results but still need fewer steps, consider: - Increasing LanPaint_StepSize to speed up the thinking process. - Decreasing LanPaint_Friction to make the Langevin dynamics converges more faster.

    3️⃣ Fix Unstability:
    If you find the results have wired texture, try

    • Reduce LanPaint_Friction to make the Langevin dynamics more stable.
    • Reduce LanPaint_StepSize to use smaller step size.
    • Reduce LanPaint_Beta if you are using a high lambda value.

    ⚠️ Notes:

    • For effective tuning, fix the seed and adjust parameters incrementally while observing the results. This helps isolate the impact of each setting. Better to do it with a batche of images to avoid overfitting on a single image.

    Community Showcase

    Discover how the community is using LanPaint! Here are some user-created tutorials:

    Submit a PR to add your tutorial/video here, or open an Issue with details!

    FAQ

    Working togather with crop&stitch

    Updates

    • 2026/09/28
      • Add Qwen-Image 2.1 image edit support: masked, instruction-driven editing (Example_32).
      • Add Qwen-Image 2.1 inpainting support with LanPaint KSampler (Example_31).
      • Inpainting a picture that carries transparency now works end to end: the 2.1 VAE is 4-in/4-out, so the alpha travels through the latent and is edited alongside the pixels. Keep the inpainting mask in its own greyscale file, since 2.1's alpha channel means image transparency.
      • LanPaint_ImageDecode now matches the decoded channel count to the source image, so an RGBA source comes back RGBA and an RGB source still comes back RGB.
    • 2026/08/12
      • v2.1.0: Significantly accelerated LanPaint using a new schedule mechanism.
      • Fix bugs for MiniMax H3 on the latest ComfyUI.
    • 2026/08/09
      • Add MiniMax H3 video + audio inpainting support (Example_29): paint per-frame video masks and audio intervals in one editor session, encode both streams into a nested AV latent, sample once, and decode back with the source fps and bit depth preserved.
      • The mask editor can export the masks into the video itself (mp4 metadata) - share a single video file and the masks travel with it.
    • 2026/06/27
      • Add Krea2 inpainting support with LanPaint KSampler (Example_28).
      • Add Ideogram4 inpainting support with LanPaint Custom Sampler Advanced (Example_27).
    • 2026/05/20
      • Add Anima inpainting and outpainting support (Example_26).
    • 2026/03/02
      • v1.5.0: Fixed a hidden bug that hurt performance and caused image blur (especially on z-image-base), and improved overall LanPaint performance on other models too.
    • 2026/01/30
      • Add Z-image-base documentation and Example_25 workflow images.
    • 2025/08/08
      • Add Qwen image support
    • 2025/06/21
      • Update the algorithm with enhanced stability and outpaint performance.
      • Add outpaint example
      • Supports Sampler Custom (Thanks to MINENEMA)
    • 2025/06/04
      • Add more sampler support.
      • Add early stopping to advanced sampler.
    • 2025/05/28
      • Major update on the Langevin solver. It is now much faster and more stable.
      • Greatly simplified the parameters for advanced sampler.
      • Fix performance issue on Flux and SD 3.5
    • 2025/04/16
      • Added Primary HiDream support
    • 2025/03/22
      • Added Primary Flux support
      • Added Tease Mode
    • 2025/03/10
      • LanPaint has received a major update! All examples now use the LanPaint K Sampler, offering a simplified interface with enhanced performance and stability.
    • 2025/03/06:

    ToDo

    • Try Implement Detailer
    • Provide inference code on without GUI. Check our local Python benchmark code LanPaintBench.

    Citation

    @article{
    zheng2025lanpaint,
    title={LanPaint: Training-Free Diffusion Inpainting with Asymptotically Exact and Fast Conditional Sampling},
    author={Candi Zheng and Yuan Lan and Yang Wang},
    journal={Transactions on Machine Learning Research},
    issn={2835-8856},
    year={2025},
    url={https://openreview.net/forum?id=JPC8JyOUSW},
    note={}
    }