ComfyUI Node

Erase

Remove an object with LaMa, and nothing else moves

By jtydhr88·Created 3 months ago·Updated about 15 hours ago· 725
Erase
  • image
  • image
force_run_token0
project_id
parent_output_id0
workflowLaMa Erase
mask_data
custom_params{}

Two ways to get rid of something in an image: tell an instruction-edit model "remove the lamp," or paint over it and let an inpainting model fill the hole. The first is how everyone edits now, but it re-renders the whole frame - every pixel comes back slightly different, and the drift compounds if you erase several things in sequence. Erase is the second way. It runs the LaMa Erase workflow: you mark the object, LaMa fills the region, and everything outside your mask is bit-identical. The unmasked pixels didn't move because they never went through a sampler.

That's the whole pitch, and it's a good one. In a chain of cleanups - take out the power line, then the sign, then the trash can - mask-based removal is what keeps the rest of the shot stable while you work.

How it works

Erase is a generation stage, not a pixel op: it wraps a real inpainting workflow. You paint a mask (the in-node editor writes it to mask_data), and the node hands your image plus that mask to LaMa, the inpainting model tuned for object removal - the workhorse of "remove this" for years because it doesn't need a prompt, just the hole. The optional image input takes a COMFYTV_IMAGE (typically straight from a picker or an earlier stage), and the output is the repaired image.

Like every ComfyTV stage it carries the hidden internal inputs - force_run_token, project_id, parent_output_id - that the frontend fills in for per-node Run. You never set those by hand.

The inputs that matter

  • workflow - which erase backend to run. Default and only sane choice is LaMa Erase; the combo exists so other backends can slot in later.
  • mask_data - the serialized mask from the in-node painting UI. This is where you actually do the work: paint generously over the whole object, including any shadow you don't want left behind.
  • image (optional) - the source. Leave it unwired and the node pulls from the project's current selection.

Installing it and the LaMa model

ComfyTV installs as one pack - ComfyUI Manager, or:

cd ComfyUI/custom_nodes
git clone https://github.com/jtydhr88/ComfyTV

Full backend restart, then find it under ComfyTV → Image.

The pack ships no pip dependencies (it's mostly frontend plus thin io.ComfyNode stages), but Erase's workflow needs two things ComfyTV won't install for you. First, the Acly/comfyui-inpaint-nodes plugin - the shipped LaMa Erase workflow calls its INPAINT_LoadInpaintModel and INPAINT_InpaintWithModel nodes, so without it the workflow fails with missing nodes:

cd ComfyUI/custom_nodes
git clone https://github.com/Acly/comfyui-inpaint-nodes.git
pip install opencv-python

Second, the model: big-lama.pt (196 MB) into ComfyUI/models/inpaint/ - note the folder name, inpaint/, not inpainting/. Both are linked in the README's models page. This is the "zero extra Python dependencies" claim in action: true of the pack itself, but the workflow still leans on a third-party node.

One more install gotcha that applies to the whole pack: on ComfyUI Desktop, macOS, or multiple installs, clone into the running instance by absolute path, verify custom_nodes/ComfyTV/__init__.py isn't nested one folder deep, and fully restart the app.

Common issues

  • Model missing or "missing nodes" - models/inpaint/ is empty, or the Acly comfyui-inpaint-nodes plugin isn't installed. Get big-lama.pt and clone the plugin per the install section above.
  • It erased the wrong thing or not enough - the mask is the interface. Redraw it; LaMa is unforgiving about a mask that misses the object's edge or shadow.
  • Edges look smeared - this is LaMa doing its thing on a complex background. You can fix up the seam by running the result through a detail pass rather than erasing again.
  • You want "remove" to also restyle - that's not Erase's job. That's an instruction-edit node (Image Edit); Erase is specifically the leave-everything-else-alone tool.
CategoryComfyTV/Image

Inputs (7)

NameTypeDefaultDescription
force_run_tokenINT00–2147483647Internal — bumped on Run to invalidate ComfyUI's input cache.
project_idSTRINGInternal — populated by the projectStore on the frontend.
parent_output_idINT00–2147483647Internal — lineage parent set by spawn handlers on the frontend.
workflowCOMBOLaMa EraseWhich erase backend to run.
mask_dataSTRING
custom_paramsSTRING{}Internal — JSON of user-defined parameter attachments/values for this node.
imageoptCOMFYTV_IMAGE

Outputs (1)

NameTypeDescription
imageCOMFYTV_IMAGE