Nodes/ComfyUI Image Saver/RandomShapeGenerator
ComfyUI Node Runs on cloud

RandomShapeGenerator

Throwaway test images without spinning up a model

By alexopus·Created 3 years ago·Updated 23 days ago· 190
RandomShapeGenerator
    • image
    • bg_rgb
    • fg_rgb
    width512
    height512
    bg_color
    fg_color
    shape_type
    seed0
    bg_color_override
    fg_color_override

    A developer's node, not an artist's. It draws a simple shape - a circle, triangle, hexagon, whatever - on a colored background and hands you the image. No model, no sampler, no VAE. The point is to get a real IMAGE into your graph instantly so you can test the plumbing downstream without waiting on a 30-second diffusion pass every single time.

    If you build or debug workflows, you know the pain: you're wiring up an upscaler, a save node, a post-processing chain, and to test it you have to run a full generation over and over. This short-circuits that. Drop in a RandomShapeGenerator, wire it where a generated image would go, and iterate on the rest of the graph at zero GPU cost. It's the ComfyUI equivalent of a placeholder image, generated on the fly.

    How it works

    It procedurally paints one shape on a background and returns the result as a standard IMAGE tensor, exactly like a real generator would. Because the colors and shape can be randomized or pinned, you can produce either endless variety (for stress-testing a batch pipeline) or one fixed known image (for a reproducible test). It also reports the actual RGB values it chose, which is handy when the thing you're testing cares about specific colors.

    The inputs and outputs

    The controls:

    • width and height (default 512, in steps of 64) - canvas size. Match it to whatever your downstream nodes expect.
    • shape_type - random, or a specific shape: circle, oval, triangle, square, rectangle, rhombus, pentagon, hexagon.
    • bg_color and fg_color - background and foreground, each random or a named color (white, black, red, green, blue, yellow, cyan, magenta).
    • seed - pin it for a reproducible image, randomize for variety on every run.

    Two optional overrides: bg_color_override and fg_color_override - string fields for supplying an exact custom color when the named-color dropdown isn't enough.

    Three outputs:

    • image (IMAGE) - the generated shape, wire it wherever a real image would go.
    • bg_rgb and fg_rgb (STRING) - the exact RGB values that got used, so a test that checks color has a ground truth to compare against.

    How to install it

    ComfyUI Manager: search "ComfyUI Image Saver", install, restart.

    Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/alexopus/ComfyUI-Image-Saver
    cd ComfyUI-Image-Saver
    pip install -r requirements.txt
    

    then restart. No models, no heavy dependencies - it's just drawing shapes with Python.

    Common issues & troubleshooting

    You wanted a real generated image. This is the big one: RandomShapeGenerator is a testing utility. It does not run a diffusion model and will never produce anything resembling a prompt. If you dropped it in expecting art, you want a KSampler and a checkpoint instead. This node exists to test the wiring around them.

    Same image every run. A fixed seed reproduces the same shape and colors by design - that's the point when you need a stable test fixture. Set the seed to randomize if you want it changing each run.

    Override color ignored. The bg_color_override / fg_color_override fields are for exact custom colors beyond the named list. If you set an override but the named dropdown is still driving the output, double-check the override string is a value the node can parse - leaving it blank falls back to the dropdown.

    Downstream size mismatch. The width/height step is 64, so dimensions land on multiples of 64. If a downstream node is fussy about exact sizes, set width and height here to match what it expects rather than assuming a default 512 fits.

    Categoryimage/generators

    Inputs (8)

    NameTypeDefaultDescription
    widthINT51264–4096Width of the generated image in pixels
    heightINT51264–4096Height of the generated image in pixels
    bg_colorCOMBOBackground color preset or random
    fg_colorCOMBOForeground shape color preset or random
    shape_typeCOMBOType of shape to generate or random
    seedINT00–18446744073709550000Random seed for reproducible shape generation
    bg_color_overrideoptSTRINGOverride background color with hex (#AABBCC) or RGB(r, g, b) format
    fg_color_overrideoptSTRINGOverride foreground color with hex (#AABBCC) or RGB(r, g, b) format

    Outputs (3)

    NameTypeDescription
    imageIMAGEGenerated image with random shape
    bg_rgbSTRINGBackground color as RGB/hex
    fg_rgbSTRINGForeground color as RGB/hex