Nodes/ComfyUI-ZML-Image/ZML_添加文字水印
ComfyUI Node

ZML_添加文字水印

Watermark text with fonts you won't get sued over

By zml-w·Created about a year ago·Updated 2 months ago· 218
ZML_添加文字水印
  • 图像
  • 图像
  • Help
文本ZML_水印
字体
字体大小48
颜色#000000
不透明度0.70
书写方向
位置
水平边距20
垂直边距20
字符间距10
行间距10
描边宽度1
描边颜色#FFFFFF
全屏水印旋转角度-30
全屏水印密度1.0

"Add your handle to the image" is the most common reason anyone opens a graphics app after a ComfyUI run, and ZML_AddTextWatermark (ZML_添加文字水印) does it without leaving the graph. It's the text sibling of the pack's image-watermark node - but with enough control to look like you did it in a real editor: choose a font, size, color, opacity, outline, writing direction, or tile the text fullscreen at an angle.

What it is

A PIL text-overlay node from ComfyUI-ZML-Image, the 160+ node utility pack by zml-w. What makes it worth your time over a generic "text image + blend" chain: it ships with fonts, and it auto-wraps. The 字体 dropdown has eight fonts bundled with the pack, and they're all marked 可商用 (commercially usable) - the author went and collected free-to-use fonts so you're not watermarking your portfolio with a pirated typeface. There's a mix of English and Chinese faces, plus an outline (描边) option and vertical (竖排) writing for that East-Asian poster look.

The inputs that matter:

  • 图像 (IMAGE), 文本 (STRING) - what you're marking and what it says.
  • 字体, 字体大小 (48), 颜色 (default #000000), 不透明度 (0.7) - the basics.
  • 书写方向 - 横排 (horizontal) or 竖排 (vertical).
  • 位置 - nine spots plus 全屏 for a tiled watermark. In fullscreen mode you get 全屏水印旋转角度 (default −30°) and 全屏水印密度 for the diagonal-stripe effect.
  • 字符间距 / 行间距 - letter and line spacing, negative values pull things tighter.
  • 描边宽度 / 描边颜色 - the outline. Leave the text color blank and set a stroke and you get transparent-fill outlined text, which the README recommends as a watermark that's hard to remove because it doesn't hide the art underneath.

There's a fun hidden rule the Help output explains: leave 颜色 empty for transparent text, or type ZML to get a random color each run.

Outputs are 图像 and a Help string (with a running watermark counter).

How it works

PIL's ImageFont.truetype loads one of the bundled fonts, and the node draws the text with automatic wrapping so it stays inside the image bounds, honoring letter/line spacing and the stroke. Opacity is applied per-pixel as alpha. It's deterministic, batch-friendly, and costs nothing - this is exactly the "reach for a $0 pixel operation instead of a diffusion pass" advice from the post-processing layer, applied to text.

Install and gotchas

Standard pack install:

cd ComfyUI/custom_nodes
git clone https://github.com/zml-w/ComfyUI-ZML-Image

or ComfyUI Manager → ComfyUI-ZML-Image, then restart. The fonts are bundled in the repo, so nothing to download.

Watch out for two things. First, the UI is Chinese; English speakers should install the translation patch from github.com/zml-w/ZZZ_ZML_English_Patch before wandering in. Second - and this is the one that actually bites - text watermarks get removed by aggressive recompression and by anyone who crops. If the point is ownership, tile it fullscreen at low opacity. And remember ComfyUI embeds the whole workflow in the PNG you save, so your "clean" export is a walking recipe for your own pipeline. The author is responsive to GitHub issues, but there's no English community to poll, so treat the node's Help output as your documentation.

Categoryimage/ZML_图像/工具

Inputs (16)

NameTypeDefaultDescription
图像IMAGE
文本STRINGZML_水印
字体COMBO8 options: 可商用/英文/Facon.ttf, 可商用/英文/thats___.ttf, 可商用/中文/nfdcsCN24.ttf, 可商用/中文/爱点风雅黑长体.ttf, 可商用/中文/平方追风体.ttf, 可商用/中文/鸿雷行书简体.otf, +2
字体大小INT488–1024
颜色STRING#000000
不透明度FLOAT0.700–1
书写方向COMBO2 options: 横排, 竖排
位置COMBO10 options: 左上, 中上, 右上, 左中, 居中, 右中, +4
水平边距INT200–4096
垂直边距INT200–4096
字符间距INT10-50–100
行间距INT10-50–200
描边宽度INT10–100
描边颜色STRING#FFFFFF
全屏水印旋转角度INT-30-360–360
全屏水印密度FLOAT1.00.5–5

Outputs (2)

NameTypeDescription
图像IMAGE
HelpSTRING