Nodes/ComfyUI-YogurtNodes/Add Text To Image (Yogurt Nodes)
ComfyUI Node

Add Text To Image (Yogurt Nodes)

Slap a caption on your output — before it leaves ComfyUI

By yogurt7771·Created 2 years ago·Updated 4 days ago· 1
Add Text To Image (Yogurt Nodes)
  • images
  • images
locationtop
centeredtrue
fontmsyh.ttc
font_size48
text_color#00000000
background_color#FFFFFFFF
text

Watermarking, labeling test grids, stamping a version number on a comparison - half the time you want text on an image, you want it baked in before it ever leaves ComfyUI. Add Text To Image does exactly that: it takes an image batch, draws text on each frame, and hands you the annotated batch back. If you've been doing this in an external editor, this is the node that deletes that step.

How it works

It's PIL under the hood. For every image in the batch, the node draws your text using the selected font at font_size, positioned at the top or bottom, optionally centered. Output is an IMAGE of the same batch size, so whatever downstream node was expecting your images still works - you've just stamped them first.

The genuinely unusual part is the color handling. Both text_color and background_color take 8-digit hex - that's RGBA-style, so #FFFFFFFF is opaque white and #00000000 is transparent black. That makes alpha composition possible: transparent background, text-only overlay. But it's also the number-one gotcha, because the defaults shipped with the node are a transparent text color over an opaque white background. Add the node, run it, and you get a white rectangle with no visible text until you set a real color. If you add this node and "nothing happened," check the colors before you check anything else.

Inputs that matter

  • images - the batch to draw on.
  • text - the actual text (multiline, so multi-line captions are fine).
  • location - top or bottom.
  • centered - true/false, whether to center horizontally.
  • font - a dropdown of fonts, and here's the thing to know: the defaults (msyh.ttc, simhei.ttf, simsun.ttc, STCAIYUN.TTF…) are Windows system fonts. On Windows they exist, so everything just works. On Linux or macOS those files often aren't present, and PIL will throw a font-loading error. If you're not on Windows, either install the fonts or be prepared to point at a font that actually exists on your box.
  • font_size - default 48.
  • text_color / background_color - the 8-digit hex colors. Remember: set the text color.

Outputs

  • images - the annotated batch. Same count, same resolution as the input.

Install

Same as every Yogurt node. ComfyUI Manager → search "ComfyUI-YogurtNodes", or:

cd ComfyUI/custom_nodes
git clone https://github.com/yogurt7771/ComfyUI-YogurtNodes.git
cd ComfyUI-YogurtNodes && pip install -r requirements.txt

Restart ComfyUI. No model downloads - this is plain image processing.

The honest review

It's a simple node and that's its virtue. There are fancier text-overlay tools in bigger packs that do outlines, shadows, multiple lines with per-line styling and god knows what else. This one does one job. Where it earns its keep is in automation: stamping prompts onto generated images for a dataset, labeling the columns of a grid before you review it, or adding a "seed 1234 / v2" watermark in a pipeline that runs unattended. If you need outlined, styled, or rotated text, you'll outgrow it fast - but for a caption strip, it's the node that gets the job done in one block instead of a detour through GIMP.

CategoryYogurtNodes/Image

Inputs (8)

NameTypeDefaultDescription
imagesIMAGEThe images to draw.
locationCOMBOtopThe location of the text.
centeredCOMBOtrueCenter the text.
fontCOMBOmsyh.ttcThe font to use.
font_sizeINT48The font size.
text_colorSTRING#00000000The color of the text.
background_colorSTRING#FFFFFFFFThe color of the background.
textSTRINGThe text to add.

Outputs (1)

NameTypeDescription
imagesIMAGE