Nodes/ComfyUI-Apt_Preset/create_RadialGradient
ComfyUI Node

create_RadialGradient

A gradient image and its mask, in one node

By cardenluo·Created 2 years ago·Updated 17 days ago· 309
create_RadialGradient
    • IMAGE
    • MASK
    width512
    height512
    gradient_distance1.00
    radial_center_x0.50
    radial_center_y0.50
    start_color_hex#000000
    end_color_hex#FFF2F2

    Radial gradients show up everywhere in a real ComfyUI pipeline: vignettes to draw the eye toward a subject, soft spotlight effects, or - the one people actually reach for it most - a smooth falloff mask for blending an edited region back into a base image without a hard seam. You could build all of that from a gradient image plus a separate image-to-mask conversion, or you can use create_RadialGradient, which gives you both outputs from the same gradient in a single node.

    How it works

    It renders a two-color radial gradient - you pick a start_color_hex at the center and an end_color_hex at the edge - and hands back an IMAGE of that gradient plus a MASK derived from its luminance. Because the mask comes straight from the same gradient math, the falloff you see in the preview is exactly the falloff you get when you plug that mask into a blend or inpaint node; there's no separate conversion step to get subtly out of sync with what you designed.

    The inputs and outputs that matter

    • width / height - canvas size, 64 to 4096, defaulting to 512.
    • radial_center_x / radial_center_y - where the gradient's center sits, as a fraction of the image (0 to 1, default 0.5/0.5 for dead center). Push these off-center for an off-axis spotlight or vignette.
    • gradient_distance - how far the gradient spreads before it fully reaches the end color, on a 0–2 scale around a default of 1. Lower it for a tighter, more concentrated falloff; raise it to spread the transition out further than the canvas edge.
    • start_color_hex / end_color_hex - plain hex strings (default #000000 to #FFF2F2, a near-white). Nothing forces black-to-white here; set any two colors for a tinted vignette or a colored glow.

    Outputs are just IMAGE (the rendered gradient, useful on its own as a background or overlay) and MASK (the same gradient read as a falloff mask, ready to wire straight into a blend node or a mask input on an inpaint chain).

    How to install it

    Comes bundled with the full pack. Through ComfyUI Manager: search "ComfyUI-Apt_Preset" → Install → restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/cardenluo/ComfyUI-Apt_Preset.git
    

    On Windows, run install.bat from inside the cloned folder afterward, using ComfyUI's own Python (the portable build's python_embeded) rather than a system Python. On Linux/Mac, activate your ComfyUI venv and install the pack's dependencies from that folder by hand. Restart ComfyUI. This node itself is pure image math with no model files or external dependencies of its own - if it's missing after a correct install, the pack's general dependency step is the thing to revisit.

    Common issues & troubleshooting

    Gradient looks reversed from what you expected. Double-check which hex you put in start_color_hex versus end_color_hex - start is the center, end is the outer edge, which is the opposite of how some other gradient tools order their color stops.

    Mask edges look too hard or too soft for a blend. That's gradient_distance, not a separate blur/feather setting - this node has no dedicated softness control beyond the gradient's own spread, so if you need a sharper cutoff than the radial falloff gives you, feed the MASK output into a proper mask-blur node afterward.

    Off-center gradient clips oddly at the canvas edge. Expected: pushing radial_center_x/y toward 0 or 1 puts the center near an edge, so more of the gradient's reach falls outside the visible canvas. That's a framing choice, not a bug - pull the center back toward 0.5 if you wanted the full radial visible.

    CategoryApt_Preset/imgEffect

    Inputs (7)

    NameTypeDefaultDescription
    widthINT51264–4096
    heightINT51264–4096
    gradient_distanceFLOAT1.000–2
    radial_center_xFLOAT0.500–1
    radial_center_yFLOAT0.500–1
    start_color_hexSTRING#000000
    end_color_hexSTRING#FFF2F2

    Outputs (2)

    NameTypeDescription
    IMAGEIMAGE
    MASKMASK