Nodes/ComfyUI Text Processor/Add text to image
ComfyUI Node

Add text to image

Burn captions onto your images without hand-positioning text

By rookiestar28·Created 10 months ago·Updated 11 days ago· 16
Add text to image
  • image
  • image
font_nameAileron Regular
text_positionbottom_center
background_modetext_box
font_size48
margin24
line_spacing5
text_color_hex#ffffff
background_color_hex#00000080
background_padding10
auto_adapttrue
min_font_size8
label_textLabel 1 Label 2

Need to slap labels onto generated images - dataset captions, batch row names, "before/after", timestamps on a video pass? Add text to image is the node that does it in-workflow, with the one feature that actually matters: auto_adapt. It wraps long text and shrinks the font until everything fits the frame, so a paragraph that would've spilled off the bottom instead renders cleanly. Turn that off and it goes the other way - truncates with an ellipsis for fixed-size rendering.

This is the pack's image node that makes its "Text Processor" name honest. It's aimed at the boring-but-endless job of annotating outputs, which is exactly the kind of thing people used to do in a separate image editor between runs.

How it works

It's Pillow under the hood. You feed an image, give it label_text (multi-line), pick an anchor (bottom_center, top_left, center_center, and so on - seven positions), and choose background_mode:

  • text_box - a background rectangle sized to the text, padded by background_padding.
  • full_width_strip - a bar across the whole image edge, the classic caption look.

Colors are hex strings. text_color_hex is straightforward (#ffffff); background_color_hex is where it gets clever - it accepts 8-digit hex, so #00000080 is black at 50% alpha. That's the difference between a caption that dominates the image and one that sits politely on it.

Fonts come from a collection the pack scans at load - drop .ttf/.otf files into ComfyUI/custom_nodes/ComfyUI_Text_Processor/fonts/. The default "Aileron Regular" is Pillow's built-in font, so the node works with zero font files out of the box, and if a workflow references a font your environment doesn't have, it tries to resolve a compatible one instead of just crashing.

It handles batches: one image gets the label, and if your text list is shorter than the image count, the labels loop. Output is always standard RGB so downstream video/image nodes don't choke on surprise alpha.

Inputs and outputs

The set you'll actually set: image, label_text, text_position, background_mode, font_size, and auto_adapt. min_font_size (default 8) caps how small auto-adapt is allowed to shrink before it gives up. Margin, line spacing, and padding are there when the default look isn't quite right.

One output: image - the batch with text rendered on.

Install

It ships inside ComfyUI Text Processor. Fastest path is ComfyUI Manager → search "ComfyUI Text Processor" → Install → restart. Or by hand:

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

No models to download; the only optional asset is fonts, and the default is fine to start.

Gotchas

If your text renders as tofu boxes (□□□), your font doesn't contain those glyphs - CJK text on the Latin default is the classic case. Drop a font that covers them into the fonts/ folder and pick it in the dropdown.

And don't fight auto_adapt when you want exact control - for a fixed badge size with precise text, disable it and let the ellipsis truncation do its thing. For everything else, leave it on; it's the reason the node exists.

CategoryComfyUI Text Processor/Image

Inputs (13)

NameTypeDefaultDescription
imageIMAGEImage batch on which labels are rendered.
font_nameCOMBOAileron RegularFont family used to render every label in the batch.
text_positionCOMBObottom_centerAnchor position for the text and its background.
background_modeCOMBOtext_boxDraw a box around the text or a strip spanning the image width.
font_sizeINT484–1024Initial label font size in pixels.
marginINT240–256Distance in pixels between the anchored text block and image edge.
line_spacingINT50–128Additional pixel spacing between wrapped text lines.
text_color_hexSTRING#ffffffText color as #RRGGBB or #RRGGBBAA.
background_color_hexSTRING#00000080Background color as #RRGGBB or #RRGGBBAA.
background_paddingINT100–50Padding in pixels between text and its background boundary.
auto_adaptBOOLEANtrueWrap and shrink labels to fit; when disabled, truncate overflowing text.
min_font_sizeINT84–128Minimum font size used while auto_adapt shrinks text.
label_textoptSTRINGLabel 1 Label 2Labels separated by newlines; labels are assigned across the image batch.

Outputs (1)

NameTypeDescription
imageIMAGEImage batch with rendered text overlays.