Nodes/ComfyUI/Draw Text Overlay
ComfyUI Node Runs on cloud

Draw Text Overlay

The node that stamps a caption on your image without touching the GPU

By Comfy-Org·Created 4 years ago·Updated about 23 hours ago· 129,495
Draw Text Overlay
  • images
  • color
  • images
text
font_size5.0
positiontop
alignleft
outlinetrue

You want a line of text on an image - a watermark, a caption, a "prompt: …" tag under your comparison grid - and you do not want to download another model or wait for a diffusion pass. That's the entire reason "Add Text Overlay" exists. It's not AI text rendering; it's a caption stamp, drawn in plain Pillow right on your CPU. If you were hoping for baked-in, in-painted lettering like AnyText does, look elsewhere - this node is deliberately dumb, and dumb is exactly what you want when you're just labeling output.

What it actually does

Under the hood it's a single ~80-line Python class. It takes your IMAGE tensor, converts it to a PIL image, and uses ImageDraw to draw text and a background rectangle, then converts the result back to a tensor. No model files, no VRAM, no requirements.txt at all - it only uses Pillow, numpy, and torch, which every ComfyUI install already has. That's also why it's safe and boring: there's nothing here to go wrong at install time, and nothing to audit past a glance at the source.

The text is always centered horizontally. Font size is locked to image_height / 20, and vertical_position (a float from -1 to 1) slides the line up or down from center - 0 is dead center, -1 pushes it toward the top, +1 toward the bottom. A background box is drawn behind the text with 10px of padding, and its transparency is set by bg_opacity (0 to 1; default 0.5). Set it to 0 and you get bare text with no box.

The inputs that matter

You set most of this once and forget it:

  • image - the IMAGE you want stamped. Feed it one image at a time (more on that below).
  • text - multiline, so you can drop in a couple of lines and they'll stack.
  • vertical_position - the only placement control you get. Everything else about position is fixed.
  • text_color_option / bg_color_option - presets only: White, Black, Red, Green, Blue. No hex codes, no sliders. Pick the two that contrast.
  • bg_opacity - transparency of that background box.
  • font_path - path to a TTF file, defaulting to /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf.

The single output is an IMAGE, and since this isn't an output node you wire it into a Save Image or Preview Image node (or back into the graph - e.g. into a VAE encode if you want to keep it as a latent, though that's unusual).

Installing it

The standard two ways, same as any custom node:

cd ComfyUI/custom_nodes
git clone https://github.com/neeltheninja/ComfyUI-TextOverlay.git

Then restart ComfyUI (or hit "Reload custom nodes" if you're in the dev mode menu). Or skip the terminal entirely: open ComfyUI Manager, search for "ComfyUI-TextOverlay", and hit install. No extra pip packages, no models to download - it just works.

Where people get burned

The one gotcha most people hit is the default font path. /usr/share/fonts/... is a Linux path, and a lot of ComfyUI runs on Windows - where that file doesn't exist. The code catches it and falls back to Pillow's built-in bitmap font, which looks like a 90s terminal and prints a "Font file not found" notice to the console. Point font_path at a real TTF (on Windows, grab a font from C:\Windows\Fonts) and the whole thing looks dramatically better.

Two more things worth knowing before you build around it. First, it expects a single image: the code squeezes the batch dimension, so piping in a batch of several images will silently misbehave. Loop or use a batch-splitting node if you need to stamp a folder. Second, the code uses Pillow's draw.textsize(), which was removed in Pillow 10 - on a recent ComfyUI install that can throw an AttributeError. If you hit it, the fix is either pinning an older Pillow or just using a different text node, because that's not something you can fix from the UI.

This is a utility, not a headline feature - 35 impressions on comfy.icu and one reddit thread calling it "fine but too basic" tells the story. But when you need a caption stamped in five seconds with zero VRAM spent, it's exactly the tool you reach for.

Categorytext

Inputs (7)

NameTypeDefaultDescription
imagesIMAGE
textSTRING
font_sizeFLOAT5.00.5–50Font size as a percentage of the image height.
colorCOLOR#ffffffColor of the text.
positionCOMBOtop2 options: top, bottom
alignCOMBOleft3 options: left, center, right
outlineBOOLEANtrueDraw a black outline around the text.

Outputs (1)

NameTypeDescription
imagesIMAGE