😺NKD Gradient Generate
Build a gradient from scratch — as a background, a mask, or a light leak
- image
- image
- mask
Gradients are the unsung workhorse of compositing - sky replacements, light leaks, vignette bases, and the background behind a product shot all want one, and until recently you either generated a noise-then-gradient or, worse, typed coordinates into a math node. 😺NKD Gradient Generate makes one from scratch, no input image needed, and lets you place it with a Photoshop-style gizmo on the preview instead of a coordinate box.
Four shapes cover the practical set: Linear, Radial, Angular (conic), and Diamond. You edit the color ramp on the node itself - click the bar to add a stop, click a stop for the native color picker, drag to move, Shift-click to remove - and you can save and load your own ramps as presets, which means your "brand" gradient is one click away forever.
What you actually set
width/height- the output size (defaults 1024×1024). Ignored if you connect the optionalimage.shape- Linear / Radial / Angular / Diamond.handlesandramp- the JSON the editor writes; you drag on the preview rather than typing these. A midpoint diamond on the gizmo biases where the 50% color lands.blend_mode- how the gradient composites over the optional image: multiply, screen, overlay, soft/hard light, add, difference, darken, lighten. This is the sneaky-good feature: a light leak, vignette, or sky grad composited straight over the image with no separate blend node.opacity- how much of the composited gradient shows through (ignored when blend mode isnone).
The optional image input is worth understanding: the gradient takes that image's size (width/height ignored), and with blend_mode you composite over it - or leave blend mode on none to use it purely as a size reference and get the bare gradient.
Outputs
image - the generated gradient. And mask, which is the luminance of the gradient - use it directly as a mask. That's the output most people miss and it's half the reason to use this node: a radial gradient's mask output is a soft-edged feathered matte for free, the thing you'd otherwise blur-and-threshold into existence.
Install and gotchas
Install via ComfyUI Manager (search ComfyUI-NKD-Basic-Tools) or:
cd ComfyUI/custom_nodes
git clone https://github.com/Nekodificador/ComfyUI-NKD-Basic-Tools
Restart after. Pack dependencies are onnxruntime and huggingface_hub; neither is needed here, so this loads on a bare install. Two things worth knowing: the mask output is always the gradient's own falloff (so a linear gradient gives you a linear alpha, not a hard matte), and the whole point of blend_mode is to skip a separate composite node - but only when you're compositing over an image, which means feeding an image in. For a standalone gradient, leave image unconnected.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| width | INT | 10248–8192 | — |
| height | INT | 10248–8192 | — |
| shape | COMBO | Linear | 4 options: Linear, Radial, Angular, Diamond |
| handles | STRING | {"p0": [0.0, 0.5], "p1": [1.0, 0.5], "mid": 0.5} | Gradient handles, dragged on the preview above. |
| ramp | STRING | {"stops": [{"pos": 0.0, "color": "#000000"}, {"pos": 1.0, "color": "#ffffff"}]} | The color ramp, edited above. |
| blend_mode | COMBO | none | How the gradient composites over the optional image. 'none' outputs the bare gradient (the image only sets the size). |
| opacity | FLOAT | 1.000–1 | How much of the composited gradient shows through. Ignored when blend_mode is 'none'. |
| imageopt | IMAGE | Optional — the gradient takes this image's size (width/height are ignored). Composite over it with blend_mode, or leave blend_mode on 'none' to use it as a size reference only. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | The generated gradient. |
| mask | MASK | Luminance of the gradient — use it as a mask. |