Nodes/ComfyUI Essentials/πŸ”§ Draw Text
ComfyUI Node Runs on cloud

πŸ”§ Draw Text

Render text onto an image (and get a mask of it too)

By cubiqΒ·Created 3 years agoΒ·Updated about a year agoΒ· 1,152
πŸ”§ Draw Text
  • img_composite
  • IMAGE
  • MASK
β—„textHello, World!β–Ί
β—„fontβ–Ύβ–Ί
β—„size56β–Ί
β—„color#FFFFFFβ–Ί
β—„background_color#00000000β–Ί
β—„shadow_distance0β–Ί
β—„shadow_blur0β–Ί
β—„shadow_color#000000β–Ί
β—„horizontal_alignβ–Ύβ–Ί
β—„vertical_alignβ–Ύβ–Ί
β—„offset_x0β–Ί
β—„offset_y0β–Ί
β—„directionβ–Ύβ–Ί

Sometimes you just need words on an image - a caption, a watermark, a label baked into a template, meme text, a title card for a video frame. DrawText renders a text string to an image with real typographic control: font size, color, alignment, offset, a drop shadow, even right-to-left direction. And it gives you a mask of the glyphs alongside the image, which is the part that makes it more than a novelty - you can composite the text into something else cleanly instead of pasting a flat rectangle.

It's from ComfyUI Essentials by cubiq (Matteo Spinelli, the ComfyUI_IPAdapter_plus author). Text rendering is exactly the kind of thing that's "weirdly missing from core," which is the pack's whole reason for existing.

How it works

You give it a string and a bunch of layout controls, and it draws the text onto a transparent (or colored) canvas using a bundled TrueType font, then returns both the rendered image and a mask that's white where the letters are. The mask is the useful trick: feed it to a composite or paste node and you can drop the text onto a photo with proper edges, recolor it, or use it as an inpaint region - none of which you can do with a pre-flattened image.

The inputs and outputs that matter

There are a lot of knobs; here are the ones you'll actually touch:

  • text (multiline string, default Hello, World!) - what to write. Multiline is supported.
  • font - a dropdown, and here's the catch: out of the box it lists a single font, ShareTechMono-Regular.ttf. More on that below.
  • size, color (#FFFFFF), background_color (#00000000, i.e. transparent) - the basics. Colors are hex; the 8-digit form includes alpha.
  • horizontal_align / vertical_align, offset_x / offset_y - where the text sits.
  • shadow_distance, shadow_blur, shadow_color - a drop shadow for legibility over busy backgrounds.
  • img_composite (optional IMAGE) - pass an image here to draw the text directly onto it.

Outputs are IMAGE (the render) and MASK (the glyph shape).

How to install it

ComfyUI Manager: search ComfyUI Essentials, install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/cubiq/ComfyUI_essentials
pip install -r ComfyUI_essentials/requirements.txt

then restart. The pack ships the default font, so there's nothing extra to download to get started.

Common issues & troubleshooting

There's only one font. That's expected - the dropdown reads from the pack's fonts folder, which ships with just ShareTechMono. To get more, drop .ttf files into that fonts directory inside the pack and restart ComfyUI; the new fonts show up in the dropdown. Don't expect a system font picker.

My background is black instead of transparent. Check background_color - the default #00000000 is transparent (the last two digits are alpha 00). A plain #000000 is opaque black. If you're then flattening to a format without alpha, the transparency is lost anyway.

The text is unreadable over a photo. Add a shadow - bump shadow_distance and shadow_blur with a contrasting shadow_color - or use the mask output to composite with more control.

Node missing after a Comfy update. Essentials is maintenance-only since April 2025 and pack nodes have broken against newer builds. Update through Manager; a rollback is the usual fallback if it's genuinely incompatible.

Categoryessentials/text

Inputs (14)

NameTypeDefaultDescription
textSTRINGHello, World!β€”
fontCOMBO1 options: ShareTechMono-Regular.ttf
sizeINT561–9999β€”
colorSTRING#FFFFFFβ€”
background_colorSTRING#00000000β€”
shadow_distanceINT00–100β€”
shadow_blurINT00–100β€”
shadow_colorSTRING#000000β€”
horizontal_alignCOMBO3 options: left, center, right
vertical_alignCOMBO3 options: top, center, bottom
offset_xINT0-16384–16384β€”
offset_yINT0-16384–16384β€”
directionCOMBO2 options: ltr, rtl
img_compositeoptIMAGEβ€”

Outputs (2)

NameTypeDescription
IMAGEIMAGEβ€”
MASKMASKβ€”