Auto Watermark Mask (OCR)
Get the mask right before you ever touch the paint
- image
- watermark_template
- symbol_reference
- mask
- mask_preview
- detected_text
Masking is the half of watermark removal everyone skips, and it's the half that decides whether the result looks clean or smeared. Auto Watermark Mask (OCR) is the detection side of the ComfyUI Auto Watermark Mask pack: it finds watermarks and hands you a ready-made mask, with no inpainting attached. If you'd rather drive your own cleanup - a ComfyUI inpaint node, a Diffusers pass, even the edit-and-stitch pattern from the wider inpainting scene - this is the node that does the tedious part for you.
The useful side effect: you get to see the mask before anything destructive happens. mask_preview exists precisely so you can confirm the detector locked onto the watermark and not the subject's face.
How it works
It shares the pack's detection pipeline with its sibling Auto Watermark Remover, so the same three modes and the same hard-case options apply:
- OCR. EasyOCR scans for readable text; whatever clears
min_confidencebecomes mask. This is the mode the "OCR" in the name is about. - CV2. A text-like-region contour heuristic catches logos and symbols that OCR can't read.
- Both.
ocr_then_cv2(the default) runs OCR first, then falls back to CV2 where no text was found - the sensible default for mixed text-plus-logo watermarks.
Beyond that, detail_detector adds two special weapons: decomposition for faint blended overlays that defeat simple contours, and symbol_template, which matches a known logo against a watermark_template image you connect. And because a huge fraction of real watermarks live in the corner, corner_fallback can slap a mask into one or more corners (top_left, bottom_right, all_corners, or region_hint to follow your region setting) when auto-detection keeps missing a border mark. Detection is downscaled for large inputs and mapped back to full resolution, so it stays fast.
The inputs that matter
image- what you're scanning.detection_mode-ocr_then_cv2is the sane default;cv2_onlyskips EasyOCR startup entirely and is the fastest path for logos;ocr_onlyfor text-only.languages- EasyOCR language codes, comma-separated (en,de).min_confidence- how sure OCR must be before it masks text. Raise it if you're masking gibberish.cv2_sensitivity- how aggressively the CV2 fallback grabs low-contrast regions. Raise for faint overlays, lower to cut false positives.detail_detectorandwatermark_template- reach for these when auto-detection keeps missing a repeated symbol or logo.padding,dilate,blur- the mask trimmers: pad if the mask clips watermark edges, dilate if thin strokes or glow edges slip through, blur to soften.
Outputs are the three you'd expect: mask (the thing you wire into any inpaint or composite node), mask_preview (visual check), and detected_text (the OCR text plus detector status messages). The mask output is a standard MASK tensor, so it plugs straight into ComfyUI's inpainting nodes, ImageCompositeMasked, or anything else that eats masks. On the symbol_template side, note the legacy symbol_reference input is just an alias for watermark_template - you only need one.
Installing it
Same pack as the remover, same install. ComfyUI Manager, search ComfyUI Auto Watermark Mask:
cd ComfyUI/custom_nodes
git clone https://github.com/goodguy1963/comfyui-auto-watermark-mask
Restart, and let Manager pull the deps. The heavy hitters are easyocr and onnxruntime-gpu (Windows x64); on Apple Silicon and non-x86 it falls back to plain onnxruntime. First OCR run downloads EasyOCR language weights - expect a slow first pass, then cached readers.
Gotchas worth knowing
- First run isn't frozen, it's downloading weights. Give EasyOCR a minute before you assume it crashed.
- GPU OCR can be finicky. If EasyOCR startup is unstable in your environment, flip
gpuoff - it defaults to on here, unlike the remover. symbol_templatewithout a template just tells you about it. The node appends "symbol template reference missing" todetected_textrather than failing - helpful, but easy to miss if you're not reading the output.- Bad templates hurt more than no template. A loose or noisy crop includes background detail that makes matching and reconstruction worse. Tight crop, similar background.
Watermark removal is one of those tasks where the generic detector will never be perfect, but this node's strength is that it doesn't pretend to be - it gives you the mask, shows it to you, and lets you decide what to do next.
Inputs (17)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| languages | STRING | en | EasyOCR language codes separated by commas, e.g. en,de. |
| detection_mode | COMBO | ocr_then_cv2 | How to build the mask. Start with cv2_only for logos and faint symbols, or ocr_then_cv2 for readable text watermarks. |
| region | COMBO | full_image | Limits the search area. Use corners or edges when the watermark is near the border for fewer false positives and faster matching. |
| min_confidence | FLOAT | 0.250–1 | Minimum OCR confidence before a text hit is added to the mask. Higher values are stricter. |
| padding | INT | 120–256 | Extra pixels added around each detected region. Increase if the mask clips the watermark edges. |
| dilate | INT | 100–256 | Expands the mask after detection. Useful when thin strokes or glow edges are missed. |
| blur | INT | 70–255 | Softens mask edges before preview and inpainting. Lower values keep the mask tighter. |
| cv2_sensitivity | FLOAT | 0.550–1 | Controls how aggressively the CV2 fallback grabs low-contrast regions. Raise it for faint overlays, lower it to reduce false positives. |
| corner_fallback | COMBO | off | Adds a simple corner mask when the watermark is pinned to a corner and automatic detection misses it. |
| corner_width_ratio | FLOAT | 0.120.02–0.5 | Corner fallback width as a fraction of image width. |
| corner_height_ratio | FLOAT | 0.080.02–0.5 | Corner fallback height as a fraction of image height. |
| gpu | BOOLEAN | true | Use GPU for EasyOCR when available. Turn off if OCR startup is unstable in your environment. |
| detail_detector | COMBO | none | Extra detector for hard cases. Use decomposition for faint blended overlays, or symbol_template when you can connect a watermark_template image. |
| symbol_match_threshold | FLOAT | 0.450–1 | Template match confidence threshold for symbol_template. Raise it to avoid lookalikes; lower it if the right watermark is being missed. |
| watermark_templateopt | IMAGE | Optional reference image of the watermark you want to find. Best results come from a tight clean crop of the watermark on a similar background. | |
| symbol_referenceopt | IMAGE | Legacy alias for watermark_template. You only need one of these inputs connected. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| mask | MASK | — |
| mask_preview | IMAGE | — |
| detected_text | STRING | — |