ComfyUI Extension: ComfyUI Auto Watermark Mask
Run ComfyUI workflows without the setup
No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.
ComfyUI custom nodes for automatic watermark masking and direct removal with OpenCV, EasyOCR, and Big-LaMa.
Looking for a different extension?
Custom Nodes (0)
README
ComfyUI Auto Watermark Mask
ComfyUI helper nodes for detecting visible watermarks, building a mask, and cleaning the detected region with OpenCV, Big-LaMa, template-aware reconstruction, or optional Diffusers inpainting.
This repository is intended to be shareable as a standalone custom node package.
The canonical install location is directly under ComfyUI/custom_nodes/comfyui-auto-watermark-mask.
What this node is good at
This node works best when the watermark is still visible enough to detect and mask.
- readable text watermarks
- corner logos and stock-photo marks
- faint semi-transparent overlays that still have recoverable edges
- known repeated watermark families when you can provide a matching template image
It is not a perfect general remover for every possible watermark. The best results come from choosing the right detection mode and, for harder symbol-style marks, connecting a watermark_template image.
ComfyUI user experience
The important controls now include hover tooltips inside ComfyUI. Hover over the input name or widget to see what it does and when to use it.
The most important idea for users is:
- start simple with automatic detection
- only switch to the heavier modes when the simple mask is wrong
- connect
watermark_templatewhen the same symbol or logo keeps appearing
symbol_reference is still accepted for older workflows, but watermark_template is the clearer user-facing name going forward.
Included nodes
Auto Watermark Mask (OCR)builds a mask from EasyOCR detections, CV2 analysis, or both.Auto Watermark Mask (OCR)also supports corner fallback masking for small corner logos that OCR and generic CV2 can miss.Auto Watermark Mask (OCR)includesdetail_detector=decompositionfor harder faint overlays.Auto Watermark Mask (OCR)includesdetail_detector=symbol_templatefor known symbol or logo watermarks when awatermark_templateimage is connected.Auto Watermark Removercleans the detected area with OpenCV or Big-LaMa.Auto Watermark Removerincludessymbol_reverse_blend, a narrower method for dark semi-transparent symbol overlays when you have a matchingwatermark_template.Auto Watermark Removerincludesgemini_reverse_alpha, an experimental special case for Gemini-style sparkle overlays.Auto Watermark Removerincludes optionaldiffusers_sd_inpaintfor harder semantic cleanup on faces, bodies, costumes, and character art.
Setup guide
Basic install
- Clone this repository into
ComfyUI/custom_nodes/comfyui-auto-watermark-mask. - Install the Python dependencies from
requirements.txtinto the same Python environment used by ComfyUI. - Restart ComfyUI.
For portable ComfyUI installs, keep a single copy of this repository directly under custom_nodes instead of maintaining a second duplicate checkout elsewhere.
Optional setup for Diffusers inpainting
Install these packages in the same environment as ComfyUI:
diffuserstransformerspillow
Then set diffusers_model_id to either:
- a local Diffusers inpainting model folder
- or a Hugging Face model id such as
stable-diffusion-v1-5/stable-diffusion-inpainting
Model setup
big_lama tries to resolve big-lama.pt in your configured ComfyUI inpaint model paths first.
If the file is missing, the node automatically downloads fashn-ai/LaMa/big-lama.pt into the first available inpaint model directory.
Notes:
- The first OCR run may download EasyOCR language weights.
- Automatic Big-LaMa download is enabled by default and can be disabled with
COMFYUI_AUTO_WATERMARK_MASK_AUTO_DOWNLOAD=0. cv2_onlyavoids EasyOCR startup cost and is the fastest mode.detail_detector=decompositionis slower than plaincv2_only, but can recover faint blended overlays that the simpler contour heuristic misses.detail_detector=symbol_templateis slower than the default path and only makes sense when you already know the watermark shape you want to remove.symbol_reverse_blendis narrower than generic inpainting: it tries to reconstruct a dark semi-transparent symbol from the matched template region before using a very small cleanup mask.diffusers_sd_inpaintis much slower than OpenCV or Big-LaMa, but it is the better fallback when the mask sits on anatomy, costume detail, or other semantic character art that the simpler inpainting methods tend to smear.opencv_teleais usually the best first pass for small text watermarks.big_lamais better when the watermark is thicker or overlaps detailed texture.gemini_reverse_alphais intentionally narrow and not a generic watermark cleanup mode.
User guide
Quick start for most images
Use Auto Watermark Remover and start with:
detection_mode:cv2_onlyregion:edgesfor border watermarks,full_imageotherwiseinpaint_method:opencv_telea
If the mask preview looks good but cleanup quality is weak:
- try
big_lama - or use
diffusers_sd_inpaintwhen the watermark crosses a face, body, costume, or detailed illustration
When to use OCR
Switch to ocr_then_cv2 when the watermark is readable text or mixed text plus shape.
Use ocr_only only when you specifically want text detection without any CV2 fallback.
When to use a watermark template
Connect watermark_template when:
- the watermark is a symbol or logo instead of text
- the same overlay appears repeatedly across images
- auto-detection keeps locking onto the wrong region
Good template sources:
- a clean external reference image of the watermark
- a tight crop of the logo from another source image with similar scale
Avoid loose or noisy templates when possible. A crop from the same image can work, but it often includes hidden background detail that makes matching and reconstruction worse.
Recommended template workflow
For detection only:
- Use
Auto Watermark Mask (OCR). - Set
detail_detectortosymbol_template. - Connect
watermark_template. - Start
symbol_match_thresholdaround0.45to0.55. - Check the
mask_previewoutput before doing removal.
For removal:
- Use
Auto Watermark Remover. - Connect the same
watermark_template. - Start with
inpaint_method=opencv_teleaorbig_lamaif the mask is correct. - Switch to
symbol_reverse_blendwhen the watermark is a dark semi-transparent symbol and a generic fill looks smeared.
Corner-logo workflow
For stock-photo style corner marks:
- set
regiontocornersoredges - enable
corner_fallback=region_hintif the automatic mask keeps missing the corner - start with
paddingaround8to16 - raise
dilateslightly if the mask clips the logo edges
Hard semantic workflow
Use diffusers_sd_inpaint when the watermark overlaps:
- faces
- skin
- anatomy
- costume details
- illustrated character features
Start with:
diffusers_strength:0.85to0.95diffusers_guidance_scale:3.5to5.5diffusers_steps:25to40diffusers_crop_padding:32to64
Recommended starting settings
detection_mode:cv2_onlyregion:edgesfor corner marks,full_imageotherwisepadding:8to16dilate:4to10blur:3to7cv2_sensitivity:0.7to0.9corner_fallback:region_hintwhen the watermark is likely pinned to a corner but auto-detection misses itcorner_width_ratio/corner_height_ratio: start around0.12/0.08for stock-photo or avatar-style marksdetail_detector: keepnoneby default, switch todecompositionwhen the watermark looks like a semi-transparent blended layer instead of crisp textdetail_detector: switch tosymbol_templatewhen the hard case is a repeated symbol-like overlay rather than readable textwatermark_template: provide a tight crop of the target symbol or logo on a similar background when usingdetail_detector=symbol_templatesymbol_match_threshold: start around0.45to0.55, raise it if the template starts latching onto lookalikesinpaint_method:opencv_teleafor speed,big_lamafor qualityinpaint_method: switch tosymbol_reverse_blendwhen the watermark is a dark semi-transparent symbol-like overlay and you have a goodwatermark_templateinpaint_method:gemini_reverse_alphaonly when the image likely contains the Gemini sparkle overlay near the bottom-right cornerinpaint_method: switch todiffusers_sd_inpaintwhen the watermark crosses a face, body, costume, or illustrated character detail and the faster methods break structurediffusers_strength: start around0.85to0.95for watermark removaldiffusers_guidance_scale: start around3.5to5.5to stay closer to the source imagediffusers_steps: start around25to40diffusers_crop_padding: start around32to64so the model sees enough local context without redrawing the whole image
Performance-focused behavior
This version keeps the same workflow shape but reduces the expensive parts of the pipeline:
- Detection work is automatically downscaled when the input image is very large, then mapped back to the original resolution mask.
- EasyOCR readers are cached per language and GPU setting.
- Big-LaMa inference runs once per ComfyUI image batch instead of one forward pass per image.
- Big-LaMa is skipped entirely when the batch has no detected mask pixels.
- Missing
big-lama.ptcan be fetched automatically from Hugging Face on first use.
Research basis
The implementation direction here matches the common public pattern in other watermark removers:
- mask detection first, then inpaint
- optional OCR when text is explicit
- LaMa for higher-quality fills
- auto-download or local caching expectations for OCR and model weights
That is still the practical open-source frontier for generic visible watermark removal in 2025 and 2026. Stronger benchmark papers exist, but the broadly reusable public implementations are still mostly detector-plus-inpainting systems, or special-case removers for one known overlay family.
The biggest gap in the original local node was not missing features, but avoidable overhead in large-image detection and per-image LaMa execution.
Implementation notes from external watermark removers:
ComfyUI-SimpleWatermarkRemoverkeeps the pipeline very small: manual mask input, pad for LaMa, auto-download the model, then run a direct inpaint pass.WaterMarkRemover_ComfyUIfollows a similarly short path and also auto-downloads the model when missing.santifer/watermark-removeradds a practical upgrade for stock-photo style cases: an explicit corner fallback before LaMa or OpenCV cleanup.IOPaintshows the more scalable pattern: treat model lookup and switching as first-class concerns, keep model discovery centralized, and avoid repeated heavy initialization.wiltodelta/remove-ai-watermarksis stronger than most current tools, but only because it special-cases the Gemini sparkle overlay with template-style detection and inverse alpha removal. That is not a generic replacement for this node.
This node intentionally combines the useful parts of those approaches without copying their code:
- automatic model bootstrap for fresh installs
- cached OCR readers and cached inpaint models
- automatic mask generation instead of manual-mask-only flows
- batched Big-LaMa inference and downscaled detection for better runtime efficiency
- optional corner fallback masking for the common small-logo corner case
- an opt-in decomposition-style detector for tougher blended overlays
- an opt-in symbol-template detector for known logo or symbol shapes that OCR is not suited to
- a symbol-specific reverse-blend remover for semi-transparent matched symbol overlays
- a separate experimental Gemini-style sparkle remover path for the one overlay family that benefits from reverse-alpha reconstruction
- an optional crop-aware Diffusers inpaint path for the harder semantic cases where texture-only fill models are not enough
Benchmark
Run the included benchmark harness to compare the optimized paths against small legacy reference implementations:
python benchmark\benchmark_node.py --repeat 30
The benchmark covers:
- full-resolution legacy CV2 detection vs current downscaled detection
- decomposition-style detection vs the legacy full-resolution CV2 path
- legacy per-image LaMa loop vs current batched LaMa path
- a synthetic Gemini-style sparkle case that measures detector runtime, remover runtime, and reconstruction error
You can also point the harness at a folder of real images:
python benchmark\benchmark_node.py --repeat 5 --input-dir .\benchmark_samples --input-limit 20
That real-sample mode reports mean runtime, hit rate, and average mask coverage for:
cv2_onlydetail_detector=decompositiondetail_detector=symbol_templatewhen you provide a matching reference symbolgemini_reverse_alpha
The synthetic runs use generated inputs and a lightweight dummy LaMa model, so they are intended for regression and relative speed checks rather than absolute quality scoring. The real-sample mode is the path to use when tuning detector defaults on your own image set.
Manager And Registry Notes
requirements.txtis included so ComfyUI-Manager can install Python dependencies.node_list.jsonis included so the node pack can be indexed even if static scanning changes.examples/auto_watermark_remover_basic.jsonprovides a minimal example workflow for the node.- The repo includes
tool.comfymetadata inpyproject.toml. - The current
PublisherIdis set togoodguy1963as the intended registry id. If you create a different Comfy Registry publisher, update that field before publishing.
Registry Publishing
The repo now includes .github/workflows/publish.yml, which follows the same publish pattern used for the earlier ThinkingLLM registry setup:
- it runs manually with
workflow_dispatch - it also runs automatically when
pyproject.tomlchanges onmain - it uses
Comfy-Org/publish-node-action@v1 - it reads the registry token from the GitHub Actions secret
REGISTRY_ACCESS_TOKEN
To make the action actually publish to ComfyUI-Manager and the Comfy Registry, you still need these prerequisites:
- Create a publisher at
https://registry.comfy.org/. - Confirm the publisher id matches
tool.comfy.PublisherIdinpyproject.toml. - Add a GitHub repository secret named
REGISTRY_ACCESS_TOKENwith a Comfy Registry publishing API key for that publisher. - Bump the semantic version in
pyproject.tomlwhen you want a new registry release, then push tomainor run the workflow manually.
Without the publisher and secret, the workflow file is correct but publishing will fail at runtime.
License
MIT
Run ComfyUI workflows without the setup
No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.