OG LaMa Refill
The One Node in This Gemini Pack That Works With the Wi-Fi Off
- image
- mask
- image
Four of the five nodes in OnlyGemini call Gemini. This one doesn't call anything. LaMaRefill ("OG LaMa Refill") is a local object eraser: paint a mask, run it, the thing is gone and the background looks like it was never there. No API key, no per-call cost, no prompt, and no internet after the first run.
Quietly the most useful node in the pack if you resent metering - and the least magical once you know what it is.
This is not diffusion, and that's the point
LaMa is a mask-driven fill network - a ResNet-style inpainting model famous for handling large masks plausibly. No sampler, no CFG, no denoise slider, no prompt. It reads the pixels around the hole and continues them. Ask it to remove a lamp post from a field and you get a very convincing field. Ask it for a person instead and you get mush, because nothing around the hole implies a person.
Mechanically it does the crop-and-paste loop masked inpainting has always done: dilate the mask, take the bounding box plus context_padding of surrounding pixels, downsample that crop to at most 1024px on the long edge (LaMa's comfort zone), run the model passes times, resize back up with Lanczos, paste into the original. The paste is a Poisson seamlessClone when the masked region has margin, a feathered alpha blend when it doesn't. Outside the mask nothing is re-rendered - your own pixels plus a feather band - which is the one guarantee instruction-editing models still can't give you.
One pleasant detail: an empty mask is a passthrough. The node returns your image untouched instead of erroring, so you can leave it inline in a chain.
The inputs
Six of them, all self-explanatory once you know what the model is doing:
imageandmask- theMaskEditorin ComfyUI, or any mask from a segmenter. Paint generously; the node will grow the mask for you.dilate_px(default 10) - grows the mask with an elliptical kernel. Turn it up for soft-edged things (hair, smoke, foliage), down for crisp objects so you don't eat adjacent detail.feather_px(default 8) - softens the blend edge of the pasted patch. Zero gives you a hard seam; 4–12 is the usual useful range for inpainted edges.passes(1–3) - repeat runs on the same crop. Two or three passes smooth out busy textures like brick or wood grain, at linear cost in time.context_padding(default 160) - how much surrounding image the model gets to look at. This is the one people leave alone and then wonder about seams: a tight crop starves the fill, a generous one lets it read the gradient it needs to continue.
Output is a single image socket. Save it, or feed it forward - OG Gemini Orchestrate's own description tells you each element going into a composite should be clean first, and points here.
Where it fits in a real workflow
Object removal on plates and backgrounds is the job. The cable across the sky, the logo on the wall, the extra chair in the corner. LaMa eats those.
It's also the cheap fix for the thing diffusion inpainting makes annoying: you don't want a new texture where the mask was, you want the old one to continue. No denoise tuning, no checkpoint, no VAE round-trip, and it costs nothing per call.
What it isn't: a face fixer, a text remover at small scale, or a way to change what's in the frame. Holes bigger than the context can describe go soft and smeary - the honest signature of LaMa. Use a diffusion inpaint with a prompt for those.
Install
Same as the rest of the pack. Manager → search OnlyGemini → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/choquevolqueta/OnlyGemini.git
cd OnlyGemini
pip install -r requirements.txt
It needs simple-lama-inpainting and opencv-python, both in that file - opencv does the dilate, crop, resize and paste. No Gemini key required; this node doesn't care whether you have one.
On first run, simple-lama-inpainting downloads the LaMa weights (~200 MB) to your torch cache. The first mask you run feels slow; the rest don't.
Where people get burned
The first run looks hung. That's the weight download, and nothing tells you clearly - the README's note is just "it is downloading the model."
Only the first frame of a batch is processed. The code takes image[0] and mask[0] and returns a batch of one. Feed it four images and you get one back. Iterate yourself; don't assume it maps over frames.
Seams at the patch edge. Bump context_padding; if the region sits against the image border, lower dilate_px so the crop has room for the seamless-blend path.
No module named cv2. opencv-python didn't land in the Python ComfyUI is running. Re-run the pip install with ComfyUI's interpreter, or install through Manager and let it handle that.
The object's gone but there's a blurry ghost. The mask was tighter than the object's soft edges. Raise dilate_px - LaMa only fills what you masked, so anything poking out survives as a smear.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| mask | MASK | — | |
| dilate_px | INT | 100–50 | Expande la máscara. Sube para objetos con bordes suaves. |
| feather_px | INT | 80–30 | Suaviza el borde del relleno. 0 = sin suavizado. |
| passes | INT | 11–3 | Iteraciones de LaMa. Más pasadas = más suave pero más lento. |
| context_padding | INT | 16020–400 | Px de contexto alrededor de la máscara. Más = mejor coherencia. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |