Nodes/ComfyUI Layer Style/LayerUtility: TextImage
ComfyUI Node Runs on cloud

LayerUtility: TextImage

Text Image (Layer Style)

By chflame163·Created 3 years ago·Updated 4 days ago· 3,113
LayerUtility: TextImage
  • size_as
  • image
  • mask
â—„textTextâ–º
◄font_file▾►
â—„spacing0â–º
â—„leading0â–º
â—„horizontal_border5.0â–º
â—„vertical_border5.0â–º
â—„scale80.00â–º
â—„variation_range0â–º
â—„variation_seed123â–º
◄layout▾►
â—„width512â–º
â—„height512â–º
â—„text_color#FFA000â–º
â—„background_color#FFFFFFâ–º

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/.otf files into the pack's font folder and they show up here.
  • width / height - the output canvas size. Or wire the optional size_as input 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 #FFA000 on white).
  • layout - horizontal or vertical; 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.

Category😺dzNodes/LayerUtility

Inputs (15)

NameTypeDefaultDescription
textSTRINGText—
font_fileCOMBO1 options: Alibaba-PuHuiTi-Heavy.ttf
spacingINT0-9999–9999—
leadingINT0-9999–9999—
horizontal_borderFLOAT5.0-100–100—
vertical_borderFLOAT5.0-100–100—
scaleFLOAT80.000.1–999—
variation_rangeINT00–100—
variation_seedINT1230–999999999999—
layoutCOMBO2 options: horizontal, vertical
widthINT5124–999999—
heightINT5124–999999—
text_colorSTRING#FFA000—
background_colorSTRING#FFFFFF—
size_asopt*—

Outputs (2)

NameTypeDescription
imageIMAGE—
maskMASK—