Nodes/ComfyUI-ZML-Image/ZML_文本图像
ComfyUI Node

ZML_文本图像

Render text into a real image, with fonts, borders and batch numbering — ZML_文本图像

By zml-w·Created about a year ago·Updated 2 months ago· 218
ZML_文本图像
  • 输入图像
  • 图像
  • Help
文本ZML_文本
字体
字体大小48
颜色#000000
书写方向
字符间距0
行间距10
文字描边宽度3
文字描边颜色#FFFFFF
背景颜色#FFFFFF
图像大小模式根据字体大小决定图像尺寸
图像宽512
图像高512
文本图像占比0.25
图像拼接方向
外边框宽度30
外边框颜色#000000
内边框宽度20
内边框颜色#000000

Sometimes you want text that isn't part of the diffusion - text as the image. ZML_文本图像 renders your prompt into a PNG using bundled fonts, and it's the node behind all those annotated comparison grids and labeled previews. It also does multi-image numbering, which turns out to be the killer feature nobody mentions.

Mechanically it's a PIL drawing job. You feed 文本 (multiline), pick one of the eight bundled fonts (including several Chinese fonts with a commercial-use license - the README notes the author hunted down free commercial fonts on purpose), set 字体大小, 颜色, 书写方向 (horizontal 横排 or vertical 竖排), 字符间距 and 行间距, then a 文字描边 width and color if you want outlined text. Color fields follow the pack convention: blank = transparent, ZML = random.

Three 图像大小模式 decide how image and font relate: size the image from the font size, size the font from a target image, or compute both independently (with 图像宽/图像高 up to 8192). The 文本图像占比 (0.1–0.5, default 0.25) controls how much of the output the text panel takes when you attach an input image.

The real value is in 输入图像. Wire an image in and the node stitches the rendered text onto it (top/bottom/left/right, with configurable outer/inner frame borders and colors). That's how you label a batch, caption a comparison, or watermark-ish an image without touching a text editor. And the numbering: the help output documents a #x:x# syntax - write ZML_#0:0.5#W in your text and it auto-numbers across a batch as 0, 0.5, 1, … with prefix/suffix applied per image. Combined with the pack's ZML_统一图像分辨率 node (they were built to pair), you can assemble labeled contact sheets entirely in-graph.

Outputs are 图像 (the rendered composite) and Help (a STRING that documents the #-# / #x:x# syntax - read it once, it's the manual).

Installing it

Part of ComfyUI-ZML-Image. Manager → ComfyUI-ZML-Image, or:

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

Restart. Fonts ship inside the pack (zml_w/Font/), no downloads. Dependencies are just Pillow (already in ComfyUI). Chinese UI by default; English patch at https://github.com/zml-w/ZZZ_ZML_English_Patch.

Common issues

The most-reported class of bug in the README's history is text-image edge cases: long English strings overflowing the font-size estimate (fixed), and multi-image mode not getting enough separators (fixed, via the #-# separator scheme). If your text gets clipped, the size-from-font mode with 文本图像占比 at its default is the reliable path; don't mix manual width/height with long text unless you're testing.

The #x:x# numbering only fires in the multi-image/batch path, and the separator #-# splits images within one text box. If numbers come out wrong, check you used the right syntax - #-# for splitting into multiple images, #start:step# for counting. The Help output explains both, in Chinese, so paste it into a note node if you need it translated.

Last, a fair warning: this node got the most love in the README of anything in the text family, so it's well-tested - but it's still Chinese-first UI on a solo-dev pack. For simple labels you might prefer core ComfyUI; reach for this one when you need Chinese fonts, auto-numbering, or the input-image composition, which nothing in core does as neatly.

Categoryimage/ZML_图像/工具

Inputs (20)

NameTypeDefaultDescription
文本STRINGZML_文本
字体COMBO8 options: 可商用/英文/Facon.ttf, 可商用/英文/thats___.ttf, 可商用/中文/nfdcsCN24.ttf, 可商用/中文/爱点风雅黑长体.ttf, 可商用/中文/平方追风体.ttf, 可商用/中文/鸿雷行书简体.otf, +2
字体大小INT481–1024
颜色STRING#000000
书写方向COMBO2 options: 横排, 竖排
字符间距INT0-10–100
行间距INT10-10–200
文字描边宽度INT30–100
文字描边颜色STRING#FFFFFF
背景颜色STRING#FFFFFF
图像大小模式COMBO根据字体大小决定图像尺寸3 options: 根据字体大小决定图像尺寸, 根据图像尺寸决定字体大小, 字体大小和图像尺寸独立计算
图像宽INT5121–8192
图像高INT5121–8192
文本图像占比FLOAT0.250.1–0.5此参数仅在接入图像时生效
图像拼接方向COMBO此参数仅在接入图像时生效
外边框宽度INT300–100此参数仅在接入图像时生效
外边框颜色STRING#000000此参数仅在接入图像时生效
内边框宽度INT200–100此参数仅在接入图像时生效
内边框颜色STRING#000000此参数仅在接入图像时生效
输入图像optIMAGE

Outputs (2)

NameTypeDescription
图像IMAGE
HelpSTRING