Nodes/KJNodes for ComfyUI/Create Gradient From Coords
ComfyUI Node Runs on cloud

Create Gradient From Coords

A gradient anchored to a moving point

By kijai·Created 3 years ago·Updated a day ago· 3,011
Create Gradient From Coords
    • image
    coordinates
    frame_width512
    frame_height512
    start_colorwhite
    end_colorblack
    multiplier1.00

    This node renders a gradient image anchored to a coordinate - and if you feed it a sequence of coordinates instead of just one, that gradient's origin moves, frame by frame. It's the third member of KJNodes' path-driven generator family, alongside Create Shape Image On Path and Create Text On Path, except instead of a shape or text, what moves is a light source.

    Why you'd want this

    The direct use is anywhere you need a soft, directional falloff tied to a specific point rather than a flat effect across the whole frame: a spotlight or vignette that tracks a subject as it moves, a depth-fade mask driven by a path instead of hand-painted, or a lighting gradient you're compositing under something else. Because the output is a plain image (not a mask), it's as usable as a visual element in its own right as it is as a blending map - feed it into a compositing node, or convert it if you need it as a mask elsewhere in your graph.

    Like its siblings, this node consumes the same coordinate format: a JSON string of {x, y} points, generally produced by KJNodes' own Spline Editor or another coordinate-emitting node upstream, though nothing stops you from typing the JSON by hand for a fixed, one-off gradient.

    How it works

    For each coordinate in your path, the node draws a gradient radiating from (or anchored at) that point, blending between start_color and end_color across the frame, and outputs one image per coordinate - so a one-point list gives you a single static gradient, and a longer path gives you an animated one.

    The inputs and outputs that matter

    • coordinates - the JSON path string (required).
    • frame_width / frame_height - canvas size, default 512×512.
    • start_color / end_color - the two ends of the gradient, defaulting to white and black.
    • multiplier (default 1, range 0.01–100) - scales the gradient's spread or intensity; push it up or down to make the falloff tighter or looser around the anchor point.

    One output: image - the rendered gradient (or gradient sequence).

    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 - this is plain procedural image generation, same as the other shape/text-on-path nodes in the pack.

    Common issues & troubleshooting

    Gradient looks flat or barely visible. Check start_color and end_color aren't too close to each other, and try adjusting multiplier - at the default it may spread the gradient much wider or tighter than you expect depending on your canvas size, since it's not automatically scaled to frame_width/frame_height.

    The anchor point is in the wrong place. Same trap as the other coordinate-driven nodes in this pack: coordinates are absolute pixel positions in the space of frame_width/frame_height. If your coordinate source was built against a different resolution than this node's canvas settings, the gradient will land off-center or clip at the edges.

    Malformed coordinates fail only when the node actually runs. If you're writing the JSON path by hand instead of piping it from a coordinate-producing node, a bracket or comma mistake won't be caught until execution - worth validating the JSON separately if a run fails and you're not sure why.

    CategoryKJNodes/image

    Inputs (6)

    NameTypeDefaultDescription
    coordinatesSTRING
    frame_widthINT51216–4096
    frame_heightINT51216–4096
    start_colorSTRINGwhite
    end_colorSTRINGblack
    multiplierFLOAT1.000.01–100

    Outputs (1)

    NameTypeDescription
    imageIMAGE