π§ Draw Text
Render text onto an image (and get a mask of it too)
- img_composite
- IMAGE
- MASK
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, defaultHello, 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.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | Hello, World! | β |
| font | COMBO | 1 options: ShareTechMono-Regular.ttf | |
| size | INT | 561β9999 | β |
| color | STRING | #FFFFFF | β |
| background_color | STRING | #00000000 | β |
| shadow_distance | INT | 00β100 | β |
| shadow_blur | INT | 00β100 | β |
| shadow_color | STRING | #000000 | β |
| horizontal_align | COMBO | 3 options: left, center, right | |
| vertical_align | COMBO | 3 options: top, center, bottom | |
| offset_x | INT | 0-16384β16384 | β |
| offset_y | INT | 0-16384β16384 | β |
| direction | COMBO | 2 options: ltr, rtl | |
| img_compositeopt | IMAGE | β |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | β |
| MASK | MASK | β |