Nodes/comfyui_bmab/BMAB Lama Inpaint
ComfyUI Node

BMAB Lama Inpaint

No-prompt object removal

By portu-sim·Created 2 years ago·Updated 8 months ago· 124
BMAB Lama Inpaint
  • image
  • masks
  • image
device

This is a different animal from BMAB's other fill nodes. LaMa ("Large Mask" inpainting, from the Samsung AI research paper "Resolution-robust Large Mask Inpainting with Fourier Convolutions") isn't a diffusion model at all - it's a CNN trained specifically to plausibly fill in a masked region using the surrounding image content, with no text prompt involved. You don't tell it what should be there; you just tell it what shouldn't be, and it removes it and blends the hole shut. That makes it the right tool for a specific, narrow job: erasing an object cleanly, not generating a new one.

How it works, and when to actually reach for it

Compare it to prompt-driven inpainting: a diffusion inpaint node needs you to describe what fills the gap, which is exactly right when you're adding or changing something ("a red scarf," "a different background"), and slightly wrong when you just want an object gone - you end up fighting the model's tendency to invent something plausible-but-visible instead of quietly extending the background. LaMa has no such tendency, because it was never trained to generate novel content; it was trained to extend textures and structure convincingly. It's also fast - no sampler, no steps, no CFG, just a forward pass through the network - which is why you'll see it show up as one of the fill method options (inpaint+lama) on BMAB's Resize By Ratio and Resize By Person nodes, where speed on a repeated per-run operation matters.

The inputs and outputs that matter

  • image (required) - the source image.
  • masks (required, MASK) - the region(s) to erase. Note the plural naming; it accepts a mask batch, not just a single mask.
  • device (enum: gpu / cpu, required) - LaMa's model is small enough that CPU is a genuinely usable fallback if your GPU is busy or VRAM-constrained elsewhere in the graph, unlike a full diffusion pass.
  • Output: image - the result with the masked region removed and filled.

There's no prompt input on this node - that's the whole point. If you find yourself wanting to describe what should replace the erased region, this is the wrong node; reach for BMAB Inpaint or BMAB Reframe instead.

How to install it

ComfyUI Manager: search comfyui_bmab. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/portu-sim/comfyui_bmab.git
cd comfyui_bmab
pip install -r requirements.txt

Same two companion packs as the rest of BMAB - Fannovel16/comfyui_controlnet_aux and cubiq/ComfyUI_IPAdapter_plus - are asked for in the README, both already in ComfyICU's shared image.

Common issues & troubleshooting

The filled region looks smeared or blurry rather than convincingly reconstructed. LaMa is good at extending flat backgrounds, textures, and simple structure; it's not good at reconstructing complex, high-frequency detail like faces or intricate patterns under a large mask. For anything the mask covers that needs real content invented - not just erased - you want a prompt-guided pass instead.

device: cpu is much slower than you expected for something billed as fast. "Fast relative to diffusion" is still relative - CPU inference on a large image can take several seconds per call, and if BMAB's resize nodes are calling this repeatedly per iteration, that adds up. Switch to gpu if you have the VRAM headroom.

A large mask leaves an obvious hole or a flat, undetailed patch. This is the honest ceiling of the technique rather than a bug: no-prompt inpainting has nothing to draw on but the surrounding pixels. Shrink the mask to the minimum area you actually need erased, or accept that a big enough gap needs a generative fill instead.

CategoryBMAB/imaging

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
masksMASK
deviceCOMBO2 options: gpu, cpu

Outputs (1)

NameTypeDescription
imageIMAGE