Erase Region (RAIW)
A mask-in, junk-out inpainter with a no-dependency mode
- image
- mask
- image
The other three nodes in this pack are watermark-specific. This one is the generic broom: give it an image and a mask, and it erases whatever the mask covers - a logo, a date stamp, a stray text bubble, a sensor spot. It's classic mask-based inpainting with two very different backends, and it's the node you'll reach for when the thing to remove isn't a registered AI watermark at all.
Mask-based inpainting has been quietly losing ground to instruction-editing models (Flux Kontext, Qwen-Image-Edit) over the last couple of years, and honestly, for big "remove that whole object" jobs an edit model is often easier. But it can't leave the rest of the image bit-identical, and this node can: what isn't masked is untouched, pixel for pixel. For a small logo or a blob of text, spinning up a full edit model is overkill - a mask, a fill, done, and the rest of your frame didn't move a single pixel.
How it works
- cv2 backend (default) - classic OpenCV inpainting, Telea or Navier-Stokes. It propagates edge information inward from the mask boundary. Instant, CPU-only, zero extra dependencies, and perfectly adequate for small or flat regions.
- lama backend - big-LaMa via onnxruntime, a proper learned inpainting model. Slower and needs the optional extra installed, but dramatically better on large areas, textures, and anything with structure the cv2 fill would smear into a blur.
There's a dilate input (default 3) that grows your mask before filling. This is the anti-halo knob - it makes sure the fill covers the soft, semi-transparent edge pixels of whatever you're removing so you don't end up with a ghost outline around the cleaned area. If you see a halo, raise it.
Inputs and outputs
- image (IMAGE) and mask (MASK) are required - the mask comes from whatever you use to draw regions in ComfyUI (or from the pack's visible-mark localization if you want to clean the detected area).
- backend -
cv2orlama, defaultcv2. - dilate - 0–64, default 3, the halo fix above.
- cv2_method -
telea(default) orns(Navier-Stokes); Telea is usually smoother, NS can hold edges a touch better. - cv2_radius - default 6, how wide an area the cv2 fill samples from around the mask. Higher = smoother but softer.
One output, image. It works per frame on a batch, matching each frame to the corresponding mask.
Install
The cv2 backend needs only the pack's base install:
cd ComfyUI/custom_nodes
git clone https://github.com/wiltodelta/ComfyUI-remove-ai-watermarks
pip install -r ComfyUI-remove-ai-watermarks/requirements.txt
Or via ComfyUI Manager ("Remove AI Watermarks"). To unlock the lama backend:
pip install "remove-ai-watermarks[lama]"
That's an onnxruntime model that downloads on first use, so your first lama run will look hung. It isn't.
Gotchas
If you select lama without installing the extra, you'll get an import error on the first run - that's the node telling you the backend isn't there. And if the result looks soft, remember the trade-off is baked in: cv2 fill will never invent texture, which is exactly why lama exists for the big stuff. If you only want the masked region to change and want to be extra safe about the untouched pixels, composite the output back with ImageCompositeMasked - belt and suspenders, but it's the standard trick.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| mask | MASK | — | |
| backendopt | COMBO | cv2 | 3 options: cv2, lama, migan |
| dilateopt | INT | 30–64 | — |
| cv2_methodopt | COMBO | telea | 2 options: telea, ns |
| cv2_radiusopt | INT | 61–64 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |