Nodes/KJNodes for ComfyUI/Create Text On Path
ComfyUI Node Runs on cloud

Create Text On Path

Animating text along a set of coordinates

By kijai·Created 3 years ago·Updated about 12 hours ago· 2,930
Create Text On Path
    • image
    • mask
    • mask_inverted
    coordinates
    texttext
    frame_width512
    frame_height512
    font
    font_size42
    alignmentcenter
    text_colorwhite
    size_multiplier1

    Create Text On Path renders a piece of text at each point in a coordinate list and gives you back an image (plus mask) per point - so instead of a static caption sitting in one spot, you get a text element that moves, frame by frame, along whatever path you feed it.

    Why you'd want this

    It's part of KJNodes' coordinate-driven generator trio, alongside Create Shape Image On Path and Create Gradient From Coords. All three consume the same kind of input: a JSON string of {x, y} points - usually produced upstream by KJNodes' Spline Editor (a draggable curve tool) or another coordinate node, though you can hand-type the JSON if you'd rather. Where the shape node gives you a moving dot and the gradient node gives you a moving light source, this one gives you moving type - kinetic-typography intros, animated captions that track a subject, a title that drifts across a frame on a curve instead of sitting dead-center the whole time.

    Because the output includes a mask (and an inverted mask), it's just as useful as a masking tool as it is a visual one: reveal an image "through" the text shape, drive an inpaint region shaped like your caption, or composite the rendered text over other content using the mask as the alpha.

    How it works

    For each coordinate, the node draws your text centered on that point, using the font, size, color, and alignment you specify, onto a canvas of the size you set. One coordinate in the list produces one frame out - same batch-per-point mechanism as its sibling nodes in the pack.

    The inputs and outputs that matter

    You need coordinates (the JSON path) and text (multiline, default "text") at minimum, plus frame_width/frame_height for canvas size (default 512×512). Then the typography controls: font (an enum populated from font files the pack ships or finds - you'll see options like FreeMono.ttf or a display face like TTNorms-Black.otf), font_size (default 42), alignment (left, center, or right - default center), and text_color.

    There's one optional input worth knowing: size_multiplier, a per-frame float list, so text can scale up or down as it travels the path instead of staying a fixed size the whole way through.

    Three outputs come out: image (the rendered text), mask, and mask_inverted - having both polarities saved means you don't need a separate Invert node depending on whether you want to reveal through the text or around it.

    How to install it

    • ComfyUI Manager - search KJNodes for ComfyUI, install, restart.
    • Manual - cd ComfyUI/custom_nodes && git clone https://github.com/kijai/ComfyUI-KJNodes, then pip install -r ComfyUI-KJNodes/requirements.txt (portable: python_embeded\python.exe -m pip install -r ComfyUI\custom_nodes\ComfyUI-KJNodes\requirements.txt), then restart.

    No models to download - this is plain PIL-style text rendering, not anything ML-driven.

    Common issues & troubleshooting

    Your custom font isn't in the list. The font dropdown only shows what the node can actually find bundled or configured - if you need a specific typeface, you'll need to make sure the font file is in a location the pack looks at rather than assuming any system font works. Stick to the listed choices if you're not sure.

    Text runs off the canvas or clips. font_size doesn't auto-shrink to fit - a long string at a large size on a small frame_width/frame_height canvas will overflow. Either shorten the text, lower font_size, or size the canvas up.

    Coordinates and canvas size don't match. Same trap as the other path-based nodes in this pack: coordinates are absolute pixel positions, so if the path was generated against a different resolution than frame_width/frame_height here, your text will land in the wrong spot or get clipped at the edges. Keep them consistent.

    Malformed coordinate JSON fails at runtime, not at graph-build time. If you're typing the path by hand rather than piping it from another node, a syntax slip won't be caught until the node actually executes - validate the JSON separately if you're debugging a failure.

    CategoryKJNodes/masking/generate

    Inputs (9)

    NameTypeDefaultDescription
    coordinatesSTRING
    textSTRINGtext
    frame_widthINT51216–4096
    frame_heightINT51216–4096
    fontCOMBO3 options: FreeMono.ttf, FreeMonoBoldOblique.otf, TTNorms-Black.otf
    font_sizeINT42
    alignmentCOMBOcenter3 options: left, center, right
    text_colorSTRINGwhite
    size_multiplieroptFLOAT1

    Outputs (3)

    NameTypeDescription
    imageIMAGE
    maskMASK
    mask_invertedMASK