Nodes/ComfyUI-WaterMark-Detector/Improved Gray Color Enhancement
ComfyUI Node

Improved Gray Color Enhancement

Boost the gray pixels — where watermarks usually live — and sharpen

By hotpizzatactics·Created 2 years ago·Updated 2 years ago· 0
Improved Gray Color Enhancement
  • image
  • IMAGE
lower_gray80
upper_gray220
boost_factor1.8
sharpen_amount2.0

Most watermarks are low-saturation. The text or logo is a neutral gray over whatever the image happens to be - that's what makes it sit on top of both bright and dark content without looking jarring. Improved Gray Color Enhancement is built around exactly that observation: it finds the pixels that are close to gray, brightens them, and sharpens the result. If your watermark is the typical semi-transparent neutral mark, this node goes straight at it.

The "Improved" in the name is doing real work, too. A naive approach would boost gray pixels and wash out the colored content around them; this one confines its effect to the gray-ish regions, so a photo keeps its colors while the mark gets lifted.

How it works

From the source, the pipeline is:

  1. Convert RGB → LAB and split the L, a, b channels.
  2. Build a mask of "gray" pixels using cv2.inRange on the a/b channels - pixels whose a and b are both within ±10 of neutral (128).
  3. Multiply the L channel by boost_factor only where that mask is set.
  4. Merge back, convert to RGB, and apply an unsharp-style sharpening with sharpen_amount.

Output is an IMAGE tensor, same color image with gray areas punched up.

The inputs - and one honest gotcha

  • boost_factor (1–5, default 1.8) - how much the gray pixels' lightness gets multiplied. This is the main lever.
  • sharpen_amount (0–5, default 2) - strength of the Gaussian unsharp pass that runs at the end.
  • lower_gray / upper_gray (0–255, defaults 80/220) - here's the gotcha: these two inputs are never actually read by the code. The gray mask is hardcoded to a/b within 128±10 regardless of what you set. They're dead sliders - they exist in the schema, they do nothing. Move them and nothing changes; don't waste time on them. If you want a tunable gray range, you're better off with the mask stage in ComprehensiveImageEnhancement or a thresholding approach.

Where it fits

Good as a second-stage node: run it after a denoise and before you combine results. And it composes well - its output is a natural input to the pack's CombineEnhancements, where you can weight it alongside a CLAHE pass. Since it only moves near-gray pixels, it's also gentle enough to preview straight at full strength without wrecking the frame.

Installing

No models, no GPU requirement:

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 pip-installs torch, numpy, opencv-python, scipy, and PyWavelets. Restart ComfyUI after installing and the node shows up under image/watermark.

Categoryimage/watermark

Inputs (5)

NameTypeDefaultDescription
imageIMAGE
lower_grayINT800–255
upper_grayINT2200–255
boost_factorFLOAT1.81–5
sharpen_amountFLOAT2.00–5

Outputs (1)

NameTypeDescription
IMAGEIMAGE