Inpainting (using Model)
The LaMa runner — fast object removal, with honest limits
- inpaint_model
- image
- mask
- optional_upscale_model
- IMAGE
"Inpainting (using Model)" is the pack's workhorse: it takes the model you loaded with Load Model Inpaint, applies it to your image and mask, and hands back a finished IMAGE. If you came here to remove a stray person, a power line, a watermark, or any "object that shouldn't be in frame" problem, this is the node you'll actually run. And it's fast - LaMa is a feed-forward CNN, so there's no sampler, no step count, no denoise. You hit run and it's done.
LaMa's superpower is that it doesn't understand what it's removing - which is exactly why it's good at removal. It hallucinates plausible texture and structure to fill the hole, trained on "large masks," which is why it beats diffusion-based fill for dead-object removal like cables and debris. The flip side: it has no idea that a person behind a car should look like a person, or that "empty scene" is a semantic concept. When you need the removed region to mean something (a proper background, a sensible object), the bundled workflow follows LaMa with an SD 1.5 inpainting pass re-rendering the region, guided by depth. Keep that split in mind: LaMa for invisible removal, diffusion for meaningful fill.
How it works
The node resizes your image and mask to a 1024×1024 square (padding with reflection), runs the model, then crops back to the original aspect. The compositing is done by mask arithmetic - result = image + (generated - image) * mask - which means the unmasked pixels are preserved bit-for-bit and only the masked region changes. That's the whole crop-and-stitch guarantee in one line.
The seed input exists and defaults to 0, but here's the thing: for LaMa it does nothing. There's no randomness in a feed-forward network, so re-running with a different seed gives you the same result. It's presumably there for future non-deterministic models; don't chase it.
The optional optional_upscale_model accepts an UPSCALE_MODEL and, if you wire one in, upscales each output patch before compositing - handy if you want the removal area at higher detail than the source.
Install
Same pack install as the others:
cd ComfyUI/custom_nodes
git clone https://github.com/SherryXieYuchen/ComfyUI-Image-Inpainting
# restart ComfyUI
(Or Manager → "ComfyUI-Image-Inpainting".) Then the one model this node needs, from Load Model Inpaint: download big-lama.pt into ComfyUI/models/inpaint/. The README's other models - the SD 1.5 inpainting checkpoint, VAE, depth ControlNet, ZoeDepth, LCM LoRA - are all for the heavier diffusion half of the bundled workflow, not for this node.
Common issues
- OOM on large images. This is the most-reported LaMa failure in the wild - a 12 GB card choking when the source image is huge. The node mitigates by resizing to 1024 square, so keep your inputs near that size, or crop first (the pack's
INPAINT_CropImageis literally the recommended workaround for big-image OOM). - "Unknown model_arch" at runtime. You loaded a non-LaMa model in Load Model. This runner only accepts the LaMa architecture.
- The fill looks like smeared texture. That's LaMa working as designed, not a bug. If you need the region to contain a real background, run a diffusion inpaint pass afterward - which is exactly what the bundled workflow does.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| inpaint_model | INPAINT_MODEL | — | |
| image | IMAGE | — | |
| mask | MASK | — | |
| seed | INT | 00–18446744073709550000 | — |
| optional_upscale_modelopt | UPSCALE_MODEL | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |