Nodes/ComfyUI_Anytext/AnyText FontImg
ComfyUI Node

AnyText FontImg

Draw text glyphs onto a masked canvas for AnyText

By zmwv823·Created 2 years ago·Updated about a year ago· 103
AnyText FontImg
  • pos_mask
  • font_img
font_nameNone
sort_radiotrue
font_color_namewhite
font_color_code00ffdd
font_color_codeR-1
font_color_codeG0
font_color_codeB0
font_color_codeA0
font_color_modetrue
bg_color_nametransparent
bg_color_code00ffdd
bg_color_modetrue
seperate_by---
prompt你好呀---Hello!
width
height

This is the typesetting node in the AnyText toolkit: it renders your actual characters, in a chosen font and color, into an image at the positions a mask defines. AnyText works by handing the diffusion model pre-drawn glyphs instead of hoping it can spell, and UL_AnyText_FontImg is one of the nodes that draws those glyphs. Out comes a font image you can preview, composite with others, or route into the rest of the pipeline.

If you've seen UL_AnyTextFontImg (no underscore) - that's the same node under a sibling name. The pack carries both across revisions, with identical inputs and outputs. Use whichever your graph already has.

How it works

You provide a pos_mask for placement and a prompt holding the text, with segments separated by the seperate_by string (default ---), so 你好呀---Hello! renders as two pieces. sort_radio decides how those segments map onto the mask's regions. The node draws the characters using font_name at your chosen size (width/height) and color, and returns the result as an IMAGE. No diffusion here - this is pure rendering, the deterministic front half of getting text into a picture.

The inputs and outputs that matter

  • pos_mask (MASK) - the positions. This drives everything; the mask regions are the text boxes.
  • prompt (STRING) - the characters, segments delimited by seperate_by.
  • seperate_by (default ---) - the segment delimiter.
  • font_name - the font. Empty (None) on this listing because the crawl instance had no fonts installed; reads ComfyUI/models/fonts on your box.
  • width / height - output canvas dimensions.
  • Colors, three ways: font_color_name (named), font_color_code (hex), font_color_codeR/G/B/A (per-channel), gated by font_color_mode; the matching bg_color_* inputs handle the background. Setting font_color_codeR to −1 defers to the name/hex.

Output: font_img (IMAGE).

How to install it

ComfyUI Manager, search ComfyUI_Anytext, or:

cd ComfyUI/custom_nodes
git clone https://github.com/zmwv823/ComfyUI_Anytext

then restart. Put fonts in ComfyUI/models/fonts - without at least Arial_Unicode.ttf there, the font_name dropdown is empty and the node has nothing to draw with.

Common issues & troubleshooting

Empty font dropdown. No fonts installed. Add .ttf/.otf files to models/fonts; the base Arial Unicode font is the safe minimum for multilingual glyphs.

Text in the wrong region. The seperate_by split has to match your mask regions in count, and sort_radio controls their order. Line up segment count with region count first.

Wrong color. The three color inputs override each other. If the R/G/B/A channels are live they take precedence; set font_color_codeR to −1 to fall back to the named color or hex. Commit to one method.

Underscore vs no underscore. UL_AnyText_FontImg and UL_AnyTextFontImg are functionally the same node. Don't burn time deciding - they behave identically.

CategoryUL Group/Image Generation

Inputs (17)

NameTypeDefaultDescription
font_nameCOMBONone1 options: None
pos_maskMASK
sort_radioBOOLEANtrue
font_color_nameCOMBOwhite149 options: transparent, red, green, blue, white, black, +143
font_color_codeSTRING00ffdd
font_color_codeRINT-1-1–255
font_color_codeGINT00–255
font_color_codeBINT00–255
font_color_codeAINT00–255
font_color_modeBOOLEANtrue
bg_color_nameCOMBOtransparent149 options: transparent, red, green, blue, white, black, +143
bg_color_codeSTRING00ffdd
bg_color_modeBOOLEANtrue
seperate_bySTRING---
promptSTRING你好呀---Hello!
widthINT
heightINT

Outputs (1)

NameTypeDescription
font_imgIMAGE