ComfyUI Node Runs on cloud

Add Label

Burn text labels onto your images

By kijai·Created 3 years ago·Updated a day ago· 3,011
Add Label
  • image
  • IMAGE
text_x10
text_y2
height48
font_size32
font_colorwhite
label_colorblack
font
textText
directionup
caption

If you've ever made an XY grid or a labeled comparison sheet, "fp8 vs Q8 vs fp16," "steps 10 / 20 / 30," "seed 1 / 2 / 3," this is the node that writes those captions onto the images. It draws a strip of text above, below, or over your picture. Pair it with ImageConcanate to build labeled comparison grids, and you've basically rebuilt the caption layer of every benchmark post on the subreddit.

It's from kijai's KJNodes, the big utility pack. Nothing fancy, but it saves you from dropping every render into an image editor to add text by hand.

How it works

It renders your text onto a new label bar and joins that bar to the image. By default the bar goes above the picture, which is the important thing to internalize: it changes the image's height. The label isn't overlaid on your existing pixels (unless you ask for that), it's a new strip added on, so the output is taller than the input. If a downstream node cares about exact dimensions, account for that.

Fonts are loaded from ComfyUI/custom_nodes/ComfyUI-KJNodes/fonts. Whatever .ttf/.otf files live in that folder show up as choices; drop your own font in there and restart to use it.

The inputs and outputs that matter

There are a lot of knobs here, but only a few you'll actually touch:

  • text (default "Text") - the label string. This is the one you set every time.
  • direction (default up) - where the label goes: up, down, left, right, or overlay. The first four add a bar on that side (and grow the image). overlay draws the text directly onto the existing image without changing its size, which is what you want for a watermark-style caption.
  • font - pick from the fonts installed in the pack's fonts folder.
  • font_size (default 32) and height (default 48) - text size and the thickness of the label bar. If the bar's too short and clips your text, raise height; a value of -1 is allowed if you want it to size itself.

The rest, text_x / text_y (text position within the bar), font_color (default white), label_color (default black), and an optional caption string, are there when you want them but have sane defaults. The output is a single IMAGE, your picture with the label attached.

Installing it

You probably already have KJNodes. If not: ComfyUI Manager → search KJNodes for ComfyUI → install → restart. Manually:

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

Restart ComfyUI. The bundled fonts come with the pack, so it works out of the box.

Common issues

My grid dimensions are off / images don't line up. Remember AddLabel grows the image by the label height. If you're concatenating several labeled images, either label them all identically (same height, same direction) so they stay aligned, or use overlay direction to keep the original size.

Text is cut off. The label bar is too short for the font. Increase height, or drop font_size, until it fits.

My font isn't in the list. The dropdown only shows files present in ComfyUI/custom_nodes/ComfyUI-KJNodes/fonts. Copy your .ttf/.otf in there and restart ComfyUI so it rescans.

Text color blends into the label. font_color and label_color are separate on purpose. White text on a black bar is the default for a reason; if you changed one, make sure they still contrast.

CategoryKJNodes/text

Inputs (11)

NameTypeDefaultDescription
imageIMAGE
text_xINT100–4096
text_yINT20–4096
heightINT48-1–4096
font_sizeINT320–4096
font_colorSTRINGwhite
label_colorSTRINGblack
fontCOMBO3 options: FreeMono.ttf, FreeMonoBoldOblique.otf, TTNorms-Black.otf
textSTRINGText
directionCOMBOup5 options: up, down, left, right, overlay
captionoptSTRING

Outputs (1)

NameTypeDescription
IMAGEIMAGE