AnyText FontImg
Render text glyphs into an image at masked positions
- pos_mask
- font_img
This node draws your text - real glyphs, in a real font - into an image, placed where a mask tells it to go. Think of it as the typesetting step: before AnyText diffuses anything, something has to lay the characters out on the canvas, and this is that something. The result is a "font image" you can preview, composite, or feed onward as a glyph hint.
It's the manual, controllable cousin of the glyph rendering the encoder does internally. When you want to see and shape the layout - colors, background, character order - before committing to a sampling pass, this is the node.
How it works
You give it a pos_mask marking where text should sit, a prompt containing the strings (split by a separator), and a font, and it renders the characters into an IMAGE at those positions. The seperate_by string (default ---) is how you delimit multiple text segments in one prompt: 你好呀---Hello! becomes two rendered pieces. sort_radio controls the ordering of how segments map to mask regions. Colors are set either by name, by hex code, or by explicit R/G/B/A - three ways in because different people reach for different ones.
The inputs and outputs that matter
pos_mask(MASK) - where the text goes. This is the load-bearing input; the mask's regions become the text boxes.prompt(STRING) - the characters to render, segments split byseperate_by.seperate_by(default---) - the delimiter between text segments. Change it if your text literally contains---.font_name- the font to draw with. ShowsNoneon this listing because the crawl box had no fonts installed; on your machine it listsComfyUI/models/fonts.width/height- the output canvas size.- Color controls come in three flavors:
font_color_name(a named color),font_color_code(hex), andfont_color_codeR/G/B/A(channels).font_color_modeand thebg_color_*set toggle which is used and style the background. Setfont_color_codeRto −1 to defer to the name/hex instead of the channel values.
Output is font_img (IMAGE) - the rendered glyph 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. The one requirement here is fonts: drop your .ttf/.otf files (at minimum Arial_Unicode.ttf) into ComfyUI/models/fonts or the font_name dropdown stays empty.
Common issues & troubleshooting
font_name is empty / says only None. No fonts in models/fonts. This node can't render characters without a font file - install at least the base Arial Unicode font.
Segments land in the wrong boxes. That's the seperate_by split not matching your mask regions, or sort_radio ordering them unexpectedly. Count your segments, count your mask regions, and make them line up.
The color isn't what I set. The three color inputs interact. If the R/G/B/A channels are active they win; set font_color_codeR to −1 to fall back to the named color or hex code. Pick one method and don't fight all three at once.
UL_AnyTextFontImg vs UL_AnyText_FontImg. The pack ships both, with identical inputs and outputs - they're two names for the same node across revisions. Whichever one your workflow has is fine; there's no behavioral difference to chase.
Inputs (17)
| Name | Type | Default | Description |
|---|---|---|---|
| font_name | COMBO | None | 1 options: None |
| pos_mask | MASK | — | |
| sort_radio | BOOLEAN | true | — |
| font_color_name | COMBO | white | 149 options: transparent, red, green, blue, white, black, +143 |
| font_color_code | STRING | 00ffdd | — |
| font_color_codeR | INT | -1-1–255 | — |
| font_color_codeG | INT | 00–255 | — |
| font_color_codeB | INT | 00–255 | — |
| font_color_codeA | INT | 00–255 | — |
| font_color_mode | BOOLEAN | true | — |
| bg_color_name | COMBO | transparent | 149 options: transparent, red, green, blue, white, black, +143 |
| bg_color_code | STRING | 00ffdd | — |
| bg_color_mode | BOOLEAN | true | — |
| seperate_by | STRING | --- | — |
| prompt | STRING | 你好呀---Hello! | — |
| width | INT | — | |
| height | INT | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| font_img | IMAGE | — |