ComfyUI Node

Text Overlay

Burn captions and watermarks onto your image without leaving ComfyUI

By silveroxides·Created 2 months ago·Updated about 7 hours ago· 24
Text Overlay
  • image
  • image
textHello World
font_size32
text_colorFFFFFF
bg_color000000
draw_backgroundtrue
bg_padding10
bg_transparency0.50
use_percentagefalse
top-1
bottom-1
left-1
right-1

Need a label on an image - a character name, a test caption, a watermark - without opening a paint program? UC_TextOverlayNode draws text directly onto any image in your graph, with a background box, transparency, padding, and flexible positioning. It's the kind of utility you don't think about until a batch of comparison renders all need their parameters stamped on them.

What it is

A pure PIL-based compositor. It takes your image, renders your text at a chosen size and color, optionally draws a padded background bar behind it at a transparency you control, and composites the result. The output is an IMAGE you can preview, save, or feed onward - so you can put labels into a pipeline and still chain processing after.

How it works

Colors are hex strings (text_color, bg_color) - no # needed, though one is tolerated. The background is drawn as RGBA using bg_transparency from 0.0 (invisible) to 1.0 (fully opaque), so at 0.5 you get a classic semi-transparent caption bar. Font loading tries Arial first, then falls back to DejaVu Sans on Linux, then to PIL's default - so it runs everywhere, though the exact font look differs between Windows and Linux.

Positioning is the part worth understanding. top, bottom, left, right all default to -1, which means center on that axis. To pin text to a corner, set one offset on each axis (say top and right) and leave the other at -1. And if you'd rather place things relative to image size, flip use_percentage on and the same four fields become percentages 0-100. That's the knob you want when a fixed-pixel offset at 512x512 looks wrong at 2K.

The inputs that matter

  • image - the canvas.
  • text - what to draw (multiline, so captions can span lines).
  • font_size - 32 default, up to 1024.
  • text_color / bg_color - hex strings.
  • draw_background - toggles the box behind the text; off means just the text.
  • bg_padding / bg_transparency - the box's padding and opacity.
  • use_percentage + top/bottom/left/right - positioning, absolute pixels or relative.

Output: a single image, ready for a Save node.

Installing it

Part of ComfyUI-UtilsCollection:

cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-UtilsCollection

Restart ComfyUI (or use Manager, search "ComfyUI-UtilsCollection"). The pack's Python dependencies are light - opencv-python and typing-extensions - and this node needs no model downloads. It does require a recent ComfyUI build since the pack targets the current Core node API.

Common issues

Most people trip on placement, not rendering. Remember -1 means "center on this axis", so top=-1, right=-1 puts text top-right - and if you set both top and bottom, the tooltip notes one wins as the offset for the other, so pick one per axis. Second, hex colors: pass six or eight hex digits, not color names. And on headless Linux boxes, the fallback font renders differently than your Windows screenshot - if you care about the exact typeface, that's the one thing this node can't control.

Categoryadvanced/image

Inputs (13)

NameTypeDefaultDescription
imageIMAGE
textSTRINGHello World
font_sizeINT321–1024
text_colorSTRINGFFFFFF
bg_colorSTRING000000
draw_backgroundBOOLEANtrue
bg_paddingINT100–1024
bg_transparencyFLOAT0.500–10.0 is fully transparent, 1.0 is fully opaque
use_percentageBOOLEANfalseIf True, top/bottom/left/right are treated as percentages (0-100) of the image size.
topINT-1-1–8192-1 for center vertically or use bottom offset
bottomINT-1-1–8192-1 for center vertically or use top offset
leftINT-1-1–8192-1 for center horizontally or use right offset
rightINT-1-1–8192-1 for center horizontally or use left offset

Outputs (1)

NameTypeDescription
imageIMAGE