ComfyUI Node

Watermark

An invisible watermark and a visible one, in the same node

By TrophiHunter·Created about a year ago·Updated about a year ago· 5
Watermark
  • image
  • IMAGE
alias
use_lsbtrue
repeat_lsbtrue
use_visual_watermarktrue
visual_watermark_locationtiled
rotate_texttrue
rotation_angle45
text_spacing_x1
text_spacing_y4
text_scale20
text_red255
text_green255
text_blue255
alpha0.250

If you batch-generate images to share, at some point you want a way to prove they're yours. This node does both kinds of watermarking at once: it can stamp a visible tiled text mark on the image and bake an invisible one into the least significant bits of the pixel data. The invisible part is the interesting trick - it survives being re-saved as PNG (mostly) and lets you later extract the author string with the pack's companion Get Watermark node. It's niche, but for a solo creator shipping batches it's a neat self-contained solution that needs no external service.

How it works

Two independent systems, both toggled:

LSB watermarking (use_lsb). The alias text - which can be anything, the author notes it could be your entire prompt - gets converted to bytes and written into the lowest bit of each channel's value. Visually it's a one-step-in-255 change per pixel, which is invisible. repeat_lsb writes the alias over and over across the whole pixel data so a cropped or truncated image still carries it.

Visual watermark (use_visual_watermark). Text drawn with PIL, positioned via visual_watermark_location (top left/right, bottom left/right, all corners, or tiled), optionally rotated (rotate_text, rotation_angle), colored with text_red/green/blue, scaled by text_scale, and blended at alpha. The text_spacing_x/y knobs control the tiled pattern's density.

Inputs that matter

  • alias - the string to embed. Keep it short if you use LSB (long aliases eat pixel data) unless repeat_lsb is on
  • use_lsb / use_visual_watermark - the two on/off switches. You can run one, the other, or both
  • visual_watermark_location - "tiled" is the default and the most theft-resistant since cropping can't remove it
  • alpha - 0–1 blend of the visible text; 0.25 default is subtle, not obnoxious

One IMAGE in, one IMAGE out.

Install

Part of Photography Nodes:

cd ComfyUI/custom_nodes
git clone https://github.com/TrophiHunter/ComfyUI_Photography_Nodes

Restart, find it under TrophiHunter/Photography (ComfyUI Manager: "Photography Nodes"). No requirements, no models.

Where people get burned

Three honest caveats. First, LSB watermarking is fragile by nature - JPEG compression, resizing, or any lossy step nukes it. It only reliably survives lossless PNG round-trips, so watermark at the very end of your chain, after every other effect, and save PNG. Second, the visual text uses whatever default font PIL can find (it tries arial.ttf and falls back), so the visible mark may look different across machines - don't rely on exact typography. Third, the extraction node needs to know alias_length if you didn't repeat the LSB, so keep your aliases a consistent length across a batch. And remember the alias you embed isn't encryption - treat LSB as provenance metadata, not copy protection.

CategoryTrophiHunter/Photography

Inputs (15)

NameTypeDefaultDescription
imageIMAGE
aliasSTRING
use_lsbBOOLEANtrue
repeat_lsbBOOLEANtrue
use_visual_watermarkBOOLEANtrue
visual_watermark_locationCOMBOtiled6 options: top left, top right, bottom left, bottom right, all corners, tiled
rotate_textBOOLEANtrue
rotation_angleINT45-360–360
text_spacing_xINT11–40
text_spacing_yINT41–40
text_scaleINT204–72
text_redINT2550–255
text_greenINT2550–255
text_blueINT2550–255
alphaFLOAT0.2500–1

Outputs (1)

NameTypeDescription
IMAGEIMAGE