AnyText FontImg
Draw text glyphs onto a masked canvas for AnyText
- pos_mask
- font_img
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 byseperate_by.seperate_by(default---) - the segment delimiter.font_name- the font. Empty (None) on this listing because the crawl instance had no fonts installed; readsComfyUI/models/fontson 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 byfont_color_mode; the matchingbg_color_*inputs handle the background. Settingfont_color_codeRto −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.
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 | — |