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

Create Shape Image On Path

Drawing a moving dot from coordinates

By kijai·Created 3 years ago·Updated a day ago· 2,908
Create Shape Image On Path
    • image
    • mask
    shapecircle
    coordinates
    frame_width512
    frame_height512
    shape_width128
    shape_height128
    shape_colorwhite
    bg_colorblack
    blur_radius0.0
    intensity1.00
    size_multiplier1
    trailing1.00
    border_width0
    border_colorblack

    This node draws a simple shape - a circle, square, or triangle - at a list of coordinates you give it, one frame per point, and hands you back an image batch (plus a matching mask). Think of it as a way to turn "here's where I want something to be, frame by frame" into an actual image sequence you can feed somewhere else in your graph.

    Why you'd want this

    It sits in KJNodes' small family of coordinate-driven generators, alongside Create Text On Path and Create Gradient From Coords - all three take the same kind of input (a JSON string of {x, y} points, typically produced by KJNodes' own Spline Editor or another coordinate-emitting node upstream, though you can also hand-type it) and turn it into pixels. The practical use cases are things like: building a synthetic motion mask to drive an animation or video model along a path you control precisely, generating a moving-dot overlay for compositing (a laser pointer, a tracking reticle, a bouncing-ball test pattern), or producing training/test masks where you need a known, reproducible shape trajectory rather than something hand-painted.

    It's not a general drawing tool - you don't get arbitrary artwork, just a shape following a path. That's the whole point: it's precise and scriptable in a way freehand masking isn't.

    How it works

    For each coordinate in your path, the node stamps the chosen shape at that location (locations are center points, not corners) and outputs one frame per coordinate, so the length of your coordinate list is the length of your output batch. The shape's size, color, and the background it sits on are all fixed settings rather than per-frame - except where a per-frame float list is explicitly supported (see size_multiplier below).

    The inputs and outputs that matter

    The essentials: shape (circle, square, or triangle), coordinates (your JSON path string), and frame_width/frame_height (canvas size, default 512×512). Then the look of the shape itself: shape_width/shape_height, shape_color and bg_color (plain color names or values, default white-on-black), plus blur_radius to soften the edges and intensity to scale brightness/opacity.

    Three optional knobs are worth knowing: size_multiplier is a per-frame float list, so the shape can grow or shrink as it moves along the path instead of staying a fixed size; trailing (0–10, default 1) blends earlier frames' shape positions into later ones for a comet-tail effect rather than a hard-cut dot; and border_width/border_color add an outline.

    Outputs are image (the rendered shape sequence) and mask (the same shape as a grayscale mask) - wire the mask into anything that wants a motion or region mask, and the image into anything treating it as visual content directly (a compositing node, or a preview).

    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 model downloads here - it's pure image drawing, no ML involved.

    Common issues & troubleshooting

    The shape doesn't show up, or shows up in the wrong place. Remember coordinates are center points, and they're in the same pixel space as frame_width/frame_height. If your path was generated at a different canvas size than you're rendering here, everything will be offset or clipped - keep the coordinate source and this node's frame dimensions in sync.

    Malformed coordinates string. Since this field is just STRING, ComfyUI won't validate the JSON for you until the node actually runs. If you're hand-writing the path instead of piping it from another node, a stray comma or bracket will fail at execution time, not at graph-build time - worth pasting it into a JSON validator first if you're debugging blind.

    Trailing looks like nothing changed. At the default of 1, the effect is subtle. Push it higher (toward the 10 max) if you want an obvious streak rather than a faint smear.

    CategoryKJNodes/image

    Inputs (14)

    NameTypeDefaultDescription
    shapeCOMBOcircle3 options: circle, square, triangle
    coordinatesSTRING
    frame_widthINT51216–4096
    frame_heightINT51216–4096
    shape_widthINT1282–4096
    shape_heightINT1282–4096
    shape_colorSTRINGwhite
    bg_colorSTRINGblack
    blur_radiusFLOAT0.00–100
    intensityFLOAT1.000.01–100
    size_multiplieroptFLOAT1
    trailingoptFLOAT1.000–10
    border_widthoptINT00–100
    border_coloroptSTRINGblack

    Outputs (2)

    NameTypeDescription
    imageIMAGE
    maskMASK