๐Text Basic
The ComfyUI text node that can finally typeset CJK vertically
- font
- image
- style
- mask
ComfyUI doesn't draw text. Out of the box it can generate images until the GPU begs for mercy, but there's no built-in node that puts words on a canvas - the "Text" nodes you'll find are just string pass-throughs. If you've ever wanted subtitles, memes, posters, or watermarks on an image, you've been bodysurfing around WAS Node Suite's text overlay or exporting text from Photoshop. S4Tools Text Basic is the core node of the small S4Tool Text pack, and it exists to fix exactly that gap.
What makes it worth a look over the other options is what it does besides rendering: it typesets vertically (real CJK vertical, columns flowing left-to-right, not just rotated text), exposes fine spacing controls, and - the part that actually matters in a graph - it hands you a clean mask and the raw RGBA as a separate "style" output, so you can composite the result onto any background without clipping artifacts. For a Chinese/Japanese poster workflow that vertical mode alone is the reason to install this pack.
How it works
Text Basic takes a FONT_DATA blob (bytes of a .ttf/.otf, produced by one of the pack's three font loaders), loads it with PIL's ImageFont.truetype, and renders the text onto a grayscale mask at 2ร resolution, then downsamples it back down with LANCZOS. That's the classic crisp-edge trick - you get anti-aliased glyphs without the blurry look of rendering at final size. The canvas is auto-sized to fit your text plus a small padding (max(8, font_size * 0.25)), and your color is applied to the RGB channels with the mask as alpha.
Inputs that matter
- font - the only non-obvious one. It's required, and it must come from a font loader node (
Text Font file,Text Font Base64, orText Font URL). Leave it dangling and the node raises "Invalid FONT_DATA: expected bytes." - text - multiline, so newlines work.
- font_size (1โ512, default 32) and color (hex, default
#000000). - text_direction -
horizontalorvertical. In vertical mode each line becomes a column. - char_spacing (-50โ200 px) and line_spacing (-10โ10, default 1.0).
line_spacingis a multiple of font size: 1.0 means zero extra gap between lines, 2.0 adds one full font-size of space. In vertical mode it controls the gap between columns instead. That trips people up, so remember: default 1.0 is not "normal" if you were picturing pixels. - align - left/center/right.
Outputs
- image - the RGBA
IMAGEtensor. Wire this into a composite/save node. - style -
STYLE_DATA: the same RGBA image, meant to feed theText Stylenode. That's a custom type, so only nodes in this pack speak it. - mask - grayscale
MASKtensor of the glyphs, for Inpaint-style or mask-based compositing.
Install
Easiest via ComfyUI Manager: search "ComfyUI S4Tool Text" and hit install. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/S4MUEL-404/ComfyUI-S4Tool-Text
Restart ComfyUI; the nodes appear under ๐S4Tool. Dependencies are just pillow, numpy, requests - all already present in any working ComfyUI - and PyTorch comes from ComfyUI itself. Note there's no requirements.txt in the repo, so Manager has nothing extra to pip-install. That's fine here, because you don't need anything. opencv-python is optional and only affects the Style node, not this one. No model files, no downloads.
Gotchas
- The canvas auto-sizes to the text. Change "hello" to "hello world" and the output dimensions change. Plan for it when you composite - resize the text canvas to your background, don't assume a fixed size.
- The image output is RGBA. If your composite node expects RGB + a separate mask, use the
maskoutput, or convert. - It's a young pack. v1.0.0, effectively no community footprint yet, so treat it as new: it works, but there's no battle-tested track record. Check the repo before pinning a workflow to it.
- Negative
line_spacingis legal and will overlap lines - occasionally useful, usually a mistake.
The workflow is simple: pick a font โ connect to Basic โ tweak โ optionally run the result through Style โ composite. For crisp, maskable, vertical-CJK-friendly text, this is now the node I reach for.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| font | FONT_DATA | โ | |
| text | STRING | โ | |
| font_size | INT | 321โ512 | โ |
| color | STRING | #000000 | โ |
| text_direction | COMBO | horizontal | 2 options: horizontal, vertical |
| align | COMBO | left | 3 options: left, center, right |
| char_spacing | INT | 0-50โ200 | โ |
| line_spacing | FLOAT | 1.0-10โ10 | โ |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | โ |
| style | STYLE_DATA | โ |
| mask | MASK | โ |