Nodes/was-node-suite-comfyui/Image Generate Gradient
ComfyUI Node Runs on cloud

Image Generate Gradient

Build a custom gradient image in ComfyUI

By WASasquatch·Created 3 years ago·Updated 2 days ago· 1,839
Image Generate Gradient
    • IMAGE
    width512
    height512
    direction
    tolerance0
    gradient_stops0:255,0,0 25:255,255,255 50:0,255,0 75:0,0,255

    Image Generate Gradient builds a gradient image from scratch - you define the colors and where they sit, and it produces a smooth blend between them. Not a gradient map applied to an existing image (that's a separate node), but the gradient itself, as a fresh image you can use as a background, a mask source, a base for compositing, or an input to other effects.

    Why generate one in the graph instead of dropping in a PNG? Because it's parametric. Change the colors, change the direction, and the gradient updates - no round-trip to an image editor, and it stays reproducible as part of the workflow.

    How it works

    You specify a set of color stops - a color and a position along the gradient - and the node interpolates smoothly between them across the image. Two stops give you a simple two-color fade; more stops let you build multi-band gradients (sunset skies, spectrum ramps, whatever). Per the WAS description you set the desired stops and colors, and typically a size and direction for the output.

    The result is a plain image, so it behaves like any other image downstream. Common uses: a soft background to composite a subject onto, a smooth ramp to drive a gradient-map or displacement effect, or a grayscale gradient used as a mask that fades an effect across the frame.

    The inputs and outputs that matter

    The meat of it is the gradient stops - the colors and where each one sits - plus the output size and the direction of the blend. The output is a single gradient image. If you want it as a mask, make a black-to-white gradient and convert; if you want it as a background, feed it straight into a blend or paste node.

    Start with two stops to get your bearings before stacking more - multi-stop gradients get fiddly fast.

    How to install it

    Comes with WAS Node Suite. Install once via ComfyUI Manager (search WAS Node Suite, install, restart) or clone it:

    cd ComfyUI/custom_nodes
    git clone https://github.com/WASasquatch/was-node-suite-comfyui
    pip install -r was-node-suite-comfyui/requirements.txt
    

    then restart. On Windows portable, run the pip step with python_embeded\python.exe -s -m pip install -r ... (or install.bat) so the requirements land in ComfyUI's Python. No models needed.

    Common issues & troubleshooting

    The colors aren't blending where you expected. Gradient stops are position-based - a stop's location decides where its color peaks. If the transition sits in the wrong place, it's the stop positions, not the node. Space them evenly for a smooth ramp; bunch them for a hard-ish band.

    Banding in the gradient. Smooth gradients are the poster child for 8-bit banding - you get visible stair-steps instead of a clean fade, most obvious on large, subtle blends. It's usually the bit depth, not the node. Add a hair of noise on top (WAS has noise nodes), or use the gradient at a larger size and downscale.

    You wanted to recolor an existing image, not make a new one. This node generates a gradient. If your goal is remapping an image's tones through a gradient (that stylized duotone look), you want Image Gradient Map instead - different node, same pack.

    The suite won't load. WAS Node Suite is a big pack that's been unmaintained since late 2023, and the recurring gotcha is an "Import Failed" after a ComfyUI update, from a dependency version clash (opencv especially). Reinstall the requirements against your ComfyUI Python and restart. The gradient node itself is dependable - it's the suite-wide install that occasionally trips.

    CategoryWAS Suite/Image/Generate

    Inputs (5)

    NameTypeDefaultDescription
    widthINT51264–4096Width of the generated image, in pixels.
    heightINT51264–4096Height of the generated image, in pixels.
    directionCOMBOWhich way the colours run. `horizontal` puts the first stop at the left edge and the last at the right; `vertical` runs top to bottom.
    toleranceINT00–255Rounds every colour channel to a multiple of this number, which turns the smooth ramp into visible bands. 0 leaves it smooth, 32 gives eight steps per channel, 64 gives four. A blur is applied afterwards, so the edges of the bands stay soft.
    gradient_stopsSTRING0:255,0,0 25:255,255,255 50:0,255,0 75:0,0,255One stop per line as position:red,green,blue, so '0:255,0,0' puts pure red at the start. Positions run 0 to 100 across the image, channels 0 to 255.

    Outputs (1)

    NameTypeDescription
    IMAGEIMAGEThe gradient, as an RGB image.