Nodes/fexli-util-node-comfyui/FERandomizedColorOut
ComfyUI Node

FERandomizedColorOut

A random pad color that's actually reproducible

By fexli·Created 3 years ago·Updated about a year ago· 3
FERandomizedColorOut
    • color
    seed0
    red_preferrandom
    green_preferrandom
    blue_preferrandom

    Outpainting has a dirty secret: the color you pad the canvas with leaks into the result. Pad with black and your extended sky comes back slightly moodier than the source; pad with the wrong shade and you'll see a tinted band where generated content meets original. The fix people land on is to pick a pad color that's somewhere in the neighborhood of the image's edge - which is a fiddly, manual job. FERandomizedColorOut automates the "somewhere" part: it rolls a random color, biased by the ranges you choose, and hands it straight to FEImagePadForOutpaint's pad_color input.

    The trick that makes it better than a plain random color is that the randomness is bounded and biased by channel. You get variation run-to-run - which is exactly what you want when batch-generating many outpainted variants - without colors so far off the mark that they fight the image.

    Inputs and output

    Three channel controls, one per color channel, each an enum with four choices:

    • random - full range, roughly -10 to 265, fully free.
    • r+ / g+ / b+ - bias the channel high (128–265). Warm highlights.
    • r~ / g~ / b~ - bias it to the midrange (64–191). Muted, safe.
    • r- / g- / b- - bias it low (-10 to 128). Dark.

    Values get clamped to 0–255 when actually used, so the out-of-range ends are just nudges. And there's a seed input, so the same seed reproduces the same color exactly.

    Output: color, an RGB_COLOR. That's the pack's own color type, so it plugs directly into FEImagePadForOutpaint's pad_color socket - a color node talking to a pad node in one wire.

    Why the bias matters

    In practice: if your source image is a sunset scene, set red and green high, blue mid, and every padded canvas will feel warm and coherent. If you're outpainting a night shot, bias everything low. The +/~/- language is a little cryptic on first read, but it's honestly clever once you map it to "bright / neutral / dark" per channel.

    Install

    From fexli-util-node-comfyui:

    cd ComfyUI/custom_nodes
    git clone https://github.com/fexli/fexli-util-node-comfyui
    cd fexli-util-node-comfyui
    pip install -r requirements.txt
    

    Or ComfyUI Manager → search fexli-util-node-comfyui → install → restart. No downloads, no config.yaml.

    Is a random-color generator overkill? If you outpaint once, yes. If you're churning out hundreds of variants, the difference between "hand-picked pad color every time" and "seeded, biased, plug-and-play pad color" is the difference between a chore and a node.

    Categoryfexli/utils

    Inputs (4)

    NameTypeDefaultDescription
    seedINT00–18446744073709550000
    red_preferCOMBOrandom4 options: random, r+, r~, r-
    green_preferCOMBOrandom4 options: random, g+, g~, g-
    blue_preferCOMBOrandom4 options: random, b+, b~, b-

    Outputs (1)

    NameTypeDescription
    colorRGB_COLOR