LayerUtility: TextImage
Text Image (Layer Style)
- size_as
- image
- mask
Text Image renders actual typed text into an image - real typography, drawn with a font, not a diffusion model guessing at letterforms. If you've ever tried to get a model to spell a word correctly and given up, this is the escape hatch: type the text, pick a font, get a crisp image of it plus a matching mask. It's how you add titles, captions, watermarks, or clean lettering that you then composite onto or into a generated picture.
The mechanism is straightforward image rendering. The node lays out your string on a canvas at the size you specify, using the chosen font, and outputs both the rendered image and a mask of the text shape - which is the part that makes it genuinely useful, because that mask lets you composite the lettering cleanly, recolor it, or drive an effect with it.
There are a lot of knobs, but only a handful matter on the first pass:
text- what to render (multiline).font_file- the typeface. By default the pack bundles a single font (Alibaba-PuHuiTi-Heavy.ttf, a heavy CJK-capable face); to get more choices you drop.ttf/.otffiles into the pack's font folder and they show up here.width/height- the output canvas size. Or wire the optionalsize_asinput to any image/mask and the node matches its dimensions, which is the tidy way to make text that fits the thing you're compositing onto.text_color/background_color- hex colors (defaults are an amber#FFA000on white).layout-horizontalorvertical; vertical is there for CJK text set in columns.
The rest - scale, spacing, leading, horizontal_border/vertical_border, and the variation_range/variation_seed pair for jittering placement - are fine-tuning you can leave alone until you need them.
Two outputs: image (the rendered text) and mask (the text shape as a mask). The mask is the money output. Feed it to a compositing node to drop the lettering onto a background with clean edges, use it to constrain an inpaint, or invert it for a knockout effect. The background_color becomes irrelevant the moment you composite via the mask, which is usually what you want.
Practical notes. The single bundled font is the thing most people trip on - if you want a specific look, you have to add the font file yourself; there's no font picker pulling from your OS. Set the color as hex including the #. And if the text overflows, bump width/height or scale rather than expecting it to auto-shrink.
Install rides with the ComfyUI Layer Style pack. ComfyUI Manager: search "ComfyUI Layer Style," install, restart. Manual: cd ComfyUI/custom_nodes && git clone https://github.com/chflame163/ComfyUI_LayerStyle, then pip install -r requirements.txt in the ComfyUI environment and restart.
The pack-level warning applies: Layer Style is big and dependency-heavy, and its most common failure is the entire pack failing to import (a transformers version clash, typically), which removes every node it contains - Text Image included - from your menu at once. If the node's missing, that's the cause; reinstall the pack, try the Manager's "Try Fix," and reinstall requirements into ComfyUI's Python env if it persists.
Inputs (15)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | Text | — |
| font_file | COMBO | 1 options: Alibaba-PuHuiTi-Heavy.ttf | |
| spacing | INT | 0-9999–9999 | — |
| leading | INT | 0-9999–9999 | — |
| horizontal_border | FLOAT | 5.0-100–100 | — |
| vertical_border | FLOAT | 5.0-100–100 | — |
| scale | FLOAT | 80.000.1–999 | — |
| variation_range | INT | 00–100 | — |
| variation_seed | INT | 1230–999999999999 | — |
| layout | COMBO | 2 options: horizontal, vertical | |
| width | INT | 5124–999999 | — |
| height | INT | 5124–999999 | — |
| text_color | STRING | #FFA000 | — |
| background_color | STRING | #FFFFFF | — |
| size_asopt | * | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |