Text Overlay
Burn captions and watermarks onto your image without leaving ComfyUI
- image
- image
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.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| text | STRING | Hello World | — |
| font_size | INT | 321–1024 | — |
| text_color | STRING | FFFFFF | — |
| bg_color | STRING | 000000 | — |
| draw_background | BOOLEAN | true | — |
| bg_padding | INT | 100–1024 | — |
| bg_transparency | FLOAT | 0.500–1 | 0.0 is fully transparent, 1.0 is fully opaque |
| use_percentage | BOOLEAN | false | If True, top/bottom/left/right are treated as percentages (0-100) of the image size. |
| top | INT | -1-1–8192 | -1 for center vertically or use bottom offset |
| bottom | INT | -1-1–8192 | -1 for center vertically or use top offset |
| left | INT | -1-1–8192 | -1 for center horizontally or use right offset |
| right | INT | -1-1–8192 | -1 for center horizontally or use left offset |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |