Nodes/ComfyUI-WaterMark-Detector/Advanced Wavelet Watermark Enhancement
ComfyUI Node

Advanced Wavelet Watermark Enhancement

The name lies — this node is actually a watermark mask maker

By hotpizzatactics·Created 2 years ago·Updated 2 years ago· 0
Advanced Wavelet Watermark Enhancement
  • image
  • IMAGE
threshold_method
manual_threshold127
block_size11
constant2
denoise_iterations2
edge_enhancetrue

Read the name and you'd expect wavelet decomposition and detail-band boosting. Read the source and you find something else entirely. Advanced Wavelet Watermark Enhancement ships with two INPUT_TYPES definitions in the class, and in Python the second one wins - so the node that actually registers is a thresholding-and-mask-cleanup node. The wavelet code is dead. What you get instead is the pack's best tool for producing a clean binary watermark mask.

That's not a bad outcome, honestly - it just isn't what the label promises. The inputs confirm it: threshold_method (otsu / adaptive / manual), manual_threshold, block_size, constant, denoise_iterations, and edge_enhance. No wavelet knobs anywhere.

How it works

The detect_watermark method is a textbook mask pipeline:

  1. Convert to grayscale.
  2. Threshold it - Otsu, adaptive Gaussian, or a plain manual threshold - to get a binary map.
  3. If denoise_iterations > 0, run open-then-close morphology (3×3 kernel) that many times to kill specks and fill holes.
  4. If edge_enhance is on, Canny-detect edges on the binary and blend them back at 0.5 weight.
  5. Output as an RGB image where the watermark region is white.

That open-then-close step is the same trick the pack's standalone MorphologicalOperations does, just baked in and looped.

The inputs that matter

  • threshold_method - start with otsu; it's zero-parameter and adapts to the image. Switch to adaptive when lighting is uneven, or manual when you want to pin a specific cut.
  • manual_threshold - only used when you pick manual; 0–255, default 127.
  • denoise_iterations - your speckle-killer. A thresholded photo full of JPEG noise benefits from 1–3 iterations.
  • edge_enhance - keep the mark's strokes crisp when you want the mask to trace text outlines rather than fill regions.

Output is a single IMAGE. Where it shines: a binary mask of the watermark is exactly what you need to restrict an inpainting pass (or to use as a control map). In the community's standard watermark-removal flow - mask, then inpaint with something like Flux Fill - this node is the mask stage. Canny-style edge maps like this also feed ControlNet preprocessors if you're going that route.

The gotcha

If you came looking for wavelet enhancement, you will not find it here. The pywt.wavedec2 code exists in the class body but is unreachable - the override killed it. For actual wavelet-based enhancement (detail coefficients scaled, then inverted), use the pack's AdvancedWatermarkEnhancement with method: wavelet. If you want a binary mask, use this node. Different jobs, and the naming only confuses them.

Installing

Nothing unusual - no models, CPU-only classical CV:

cd ComfyUI/custom_nodes
git clone https://github.com/hotpizzatactics/ComfyUI-WaterMark-Detector

or search ComfyUI-WaterMark-Detector in ComfyUI Manager. The pack's install.py pulls in torch, numpy, opencv-python, scipy, and PyWavelets. Restart ComfyUI after installing. It's arbitrary Python at import time like every custom node, but there's no network code and no model files here - about as low-risk as this ecosystem gets.

Categoryimage/watermark

Inputs (7)

NameTypeDefaultDescription
imageIMAGE
threshold_methodCOMBO3 options: otsu, adaptive, manual
manual_thresholdINT1270–255
block_sizeINT113–99
constantINT2-10–10
denoise_iterationsINT20–10
edge_enhanceBOOLEANtrue

Outputs (1)

NameTypeDescription
IMAGEIMAGE