ComfyUI Node

Snap Text

Snap-Style Caption Bars, Right There in the Graph

By SignalCha1n·Created about a year ago·Updated about a year ago· 4
Snap Text
  • image
  • IMAGE
textYour Text Here
font_namearial.ttf
font_size_ratio0.050
vertical_placementmiddle
custom_vertical_percentage0.0
text_color#FFFFFF
vertical_padding_ratio_of_size0.70
line_spacing4
bar_color#000000
bar_alpha0.50

SnapTextOverlay is the star of the ComfySnap pack: it stamps the familiar semi-transparent black bar with white text onto an image, Snap-story style, entirely inside ComfyUI. You could do this in an image editor after the fact, sure - but then you lose the workflow, the batch processing, and the ability to reposition the bar from a seed. This node keeps the whole thing in the graph: feed it any IMAGE, get the captioned IMAGE back. If you're making meme-adjacent content, story-style images, or anything where the caption is part of the joke, this is the one you'll actually keep.

How it works

Pure PIL drawing, no models involved. It measures your text at a chosen font size, wraps it to the image width (minus a small side margin), sizes the bar to fit the text plus padding, and composites a semi-transparent rectangle and the text onto the image. The font size is relative to the image width - font_size_ratio 0.05 means 5% of the width - so the same node scales caption and bar proportionally whether your image is 512 wide or 2048. Text is centered horizontally; vertical placement is what you control.

The inputs that matter

  • text - the caption. It's a single-line STRING, not a prompt box; if you want multiple lines you'll need to feed in \n-joined text from elsewhere.
  • font_size_ratio - the headline control. Default 0.05.
  • vertical_placement - top, middle, bottom, or custom. Choose custom and you get custom_vertical_percentage, a 0–100 scale where 0 = bottom and 100 = top. Note that scale is the same convention Face Avoid outputs, which is not an accident - the two nodes are designed to wire together.
  • text_color and bar_color - hex strings, defaults #FFFFFF and #000000.
  • bar_alpha - the bar's opacity, 0 to 1. 0.5 is the classic Snap look.
  • vertical_padding_ratio_of_size - bar height as a fraction of font size; 0.7 is snug, higher gives a fatter bar.

One IMAGE in, one IMAGE out, batch-preserved.

The killer combo

Run a face detector → Face Avoid (FaceAvoidRandomY) → feed its vertical_pos_100_top FLOAT into this node's custom_vertical_percentage. That's the pack's flagship workflow, bundled as an example JSON in the repo, and it's exactly how you keep captions off faces while still getting a random position each run. Without it, you're back to guessing a number and re-rendering.

Installing it

Same story as the rest of the pack: it is not in ComfyUI Manager, so the manager search returns nothing. Clone it straight from GitHub:

cd ComfyUI/custom_nodes
git clone https://github.com/SignalCha1n/comfyui-ComfySnap

Restart ComfyUI, and the node lives under the ComfySnap category. It needs torch, numpy, and PIL - all present in a stock ComfyUI. Ignore the pack's requirements.txt, which pins a museum-piece torch==1.13.1; don't let a text node downgrade your environment.

Where it bites

The big one is fonts, and it's cross-platform in the worst way. The font loader looks for font_name in the Windows system fonts directory first (it reads SystemRoot, which only exists on Windows) before falling back through the working directory and the node's own folder. On Windows, arial.ttf just works. On Linux or macOS, if you don't point font_name at an actual font file, PIL silently falls back to its built-in default font - a tiny bitmap font that ignores font_size_ratio entirely. Your caption will render, but small and jagged no matter what the slider says. Fix: drop a real .ttf somewhere and give the node its path. Second gotcha: custom_vertical_percentage is bottom=0 / top=100, the inverse of most sliders - and if Face Avoid's output isn't wired in, the placement is just whatever static number you set. Last one: this is per-frame PIL drawing, so a long batch takes real time; keep captions to batches you can actually wait for.

CategoryComfySnap

Inputs (11)

NameTypeDefaultDescription
imageIMAGE
textSTRINGYour Text Here
font_nameSTRINGarial.ttf
font_size_ratioFLOAT0.0500.01–0.2
vertical_placementCOMBOmiddle4 options: top, middle, bottom, custom
custom_vertical_percentageFLOAT0.00–100
text_colorSTRING#FFFFFF
vertical_padding_ratio_of_sizeFLOAT0.700–3
line_spacingINT40–50
bar_colorSTRING#000000
bar_alphaFLOAT0.500–1

Outputs (1)

NameTypeDescription
IMAGEIMAGE