Gradient RGB image
The gradient generator gradient scaling wants
- mask
- IMAGE
- MASK
Pre CFG gradient scaling lets you steer a generation by feeding it an image - and its README is basically a gallery of what you can do with gradients specifically: light coming from one corner, a vignette that darkens the edges, a color field that shifts the whole palette. Gradient RGB image is the generator purpose-built for those. It's the sibling of Empty RGB image in this pack, but instead of a flat color it produces a smooth ramp between two colors, with a matching mask output that makes vignettes trivial.
The mechanism is straightforward tensor math: it builds a 0-to-1 gradient across the image, then interpolates from your first color to your second color along it. What makes it more than a toy is axis - vertical, horizontal, or circular. The circular mode multiplies two perpendicular sine gradients together to produce a radial falloff, which is exactly the shape you want for a vignette. power_to (1–16) is the curve control: crank it past 1 and the gradient concentrates toward one end instead of ramping evenly, which is how you turn a gentle light gradient into a hard spotlight effect. reverse_power flips which end gets the concentration.
Inputs to care about:
r1/g1/b1andr2/g2/b2- the start and end colors of the ramp (default black to white).axis- vertical, horizontal, or circular.power_to/reverse_power- the falloff curve.- Optional
mask- multiply the gradient by an existing mask to confine it to part of the image.
The outputs are the useful part: IMAGE is the colored gradient to feed into gradient scaling as a guide, and MASK is the same gradient as a mask - wire that into gradient scaling's input_mask and you've built a per-pixel strength control for free. The README's vignetting example is literally "circular gradient + its own mask."
Where this node shines is the pattern-matching side of gradient scaling: a black-and-white spiral, a blue-on-black ramp, a text-like block - because gradient scaling works on values, not semantics, a clean procedural gradient gives it a clear target to push the generation toward without any image editing software.
Install with the rest of the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/Extraltodeus/pre_cfg_comfy_nodes_for_ComfyUI
or via ComfyUI Manager searching pre_cfg_comfy_nodes_for_ComfyUI, then restart. No dependencies beyond torch.
If gradient scaling is the experiment bench, this node is the paint you mix on it. Start with a vertical ramp and power_to of 2 - that's the classic "light from the left" test.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| width | INT | 10240–16384 | — |
| height | INT | 10240–16384 | — |
| r1 | INT | 00–255 | — |
| g1 | INT | 00–255 | — |
| b1 | INT | 00–255 | — |
| r2 | INT | 2550–255 | — |
| g2 | INT | 2550–255 | — |
| b2 | INT | 2550–255 | — |
| axis | COMBO | 3 options: vertical, horizontal, circular | |
| power_to | INT | 11–16 | — |
| reverse_power | BOOLEAN | false | — |
| maskopt | MASK | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| MASK | MASK | — |