Nodes/MTB Nodes/Text To Image (mtb)
ComfyUI Node Runs on cloud

Text To Image (mtb)

Render literal text onto an image, no diffusion involved

By melMass·Created 3 years ago·Updated about a month ago· 721
Text To Image (mtb)
  • color
  • background
  • whisper_chunks
  • IMAGE
textHello world!
font
wraptrue
trimtrue
line_height1.0
font_size32
width512
height512
h_alignleft
v_aligntop
h_offset0
v_offset0
h_coverage100
fps24
fade_duration0.5

Despite living in the same graph as your diffusion pipeline, this node doesn't generate anything with a model - it draws text. Literal, bitmap, font-rendered text: give it a string and it hands back an IMAGE with that text painted on. Title cards, watermarks, captions, meme-text overlays - anywhere you need words as pixels rather than words as a prompt.

How it works

It looks for font files in a fonts folder inside your ComfyUI directory, and falls back to a default built-in font if it doesn't find any there. Drop .ttf files into comfy_dir/fonts and they show up in the font dropdown.

The inputs that matter

There's a lot of fields here - this is one of the pack's more fully-fleshed-out nodes - but most of them are exactly what you'd expect from a text tool:

  • text - what to render, default "Hello world!".
  • font - picked from your fonts folder.
  • font_size, width, height - canvas and text sizing.
  • color / background - text and background color.
  • wrap / trim - whether long text wraps to multiple lines, and whether whitespace gets trimmed.
  • h_align/v_align (left/center/right, top/center/bottom) and h_offset/v_offset - positioning within the canvas.
  • h_coverage - a percentage controlling how much of the canvas width the text block should try to fill, which effectively auto-sizes the text rather than making you hand-tune font_size for every string length.

Then two optional inputs that hint at the node's more interesting use case: whisper_chunks (a WHISPER_CHUNKS type - timed transcript segments, the kind a Whisper speech-to-text node produces) plus fps and fade_duration. Wire those in and this stops being a static title-card generator and becomes a per-frame subtitle renderer: each Whisper chunk's timing drives which words are on screen for which frames, with a fade in/out over fade_duration seconds. That's a real, if niche, auto-captioning pipeline built out of this one node plus a Whisper transcription node feeding it.

Output: a single IMAGE, which composites over your generated frame (or stands alone, for a plain title card) however the rest of your graph handles layering.

Installing it

ComfyUI Manager: search "MTB Nodes," install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/melMass/comfy_mtb

restart, and if the node's missing, run pip install -r requirements.txt from inside the comfy_mtb folder - text rendering pulls in Pillow, which is usually already present but worth checking if this specific node fails to import when others in the pack work fine.

Common issues

If your font dropdown only shows a default option, you haven't dropped any .ttf files into comfy_dir/fonts yet - that folder isn't created for you automatically in every install, so make it yourself if it's missing. If text renders but positioning looks off, h_coverage is worth checking first: since it auto-scales to fill a percentage of the canvas width, a h_coverage set too high can make short strings render huge, and too low can make long strings shrink smaller than you'd expect from font_size alone - the two settings interact, so don't tune them independently.

Categorymtb/generate

Inputs (18)

NameTypeDefaultDescription
textSTRINGHello world!
fontCOMBO1 options: font
wrapBOOLEANtrue
trimBOOLEANtrue
line_heightFLOAT1.0
font_sizeINT321–2500
widthINT5121–8096
heightINT5121–8096
colorCOLORblack
backgroundCOLORwhite
h_alignCOMBOleft3 options: left, center, right
v_alignCOMBOtop3 options: top, center, bottom
h_offsetINT00–8096
v_offsetINT00–8096
h_coverageINT1001–100
whisper_chunksoptWHISPER_CHUNKS
fpsoptINT241–60
fade_durationoptFLOAT0.50–5

Outputs (1)

NameTypeDescription
IMAGEIMAGE