Nodes/ComfyUI-Majoor-ImageOps/〽️ Image Ops Ramp
ComfyUI Node

〽️ Image Ops Ramp

ImageOps Ramp is more useful than it looks

By MajoorWaldi·Created 8 months ago·Updated 8 days ago· 11
〽️ Image Ops Ramp
  • color_a
  • color_b
  • image
  • mask
  • width
  • height
  • frame_count
width1024
height1024
frame_count1
alpha1.00
start_x0.000
start_y0.500
end_x1.000
end_y0.500
ramp_shapelinear
ramp_modelinear
invertfalse

A gradient generator sounds like the kind of node you use once to test something and forget. But ImageOps Ramp earns its place in the graph because it thinks like a compositing tool, not a paint program: it's a linear or radial ramp with a matching mask, and it's batch-aware. That combination turns it into everything from a background plate to a vignette, a spotlight matte, or a luma-based mask source - without you ever leaving ComfyUI.

It's one of the procedural generator nodes in the MajoorWaldi ImageOps pack, the same collection that gives you Constant, Noise, and Grain. The pack's whole stance - from its README and the author's own posts - is "stop treating every tiny image operation as a full queue-and-pray cycle," and generators like this are the ground floor of that: you tweak, the embedded live preview updates instantly, no queue needed.

How it works

The math is refreshingly honest. For a linear ramp, every pixel gets a value t equal to its projection onto the segment from start to end (clamped to 0–1). A radial ramp instead measures each pixel's distance from the start point, divided by the length of the start→end segment - so the end point sets the radius. Then ramp_mode reshapes that value: ease_in squares it, ease_out runs 1-(1-t)², smoothstep gives you the standard gentle t²(3-2t) S-curve. Finally rgb = color_a*(1-t) + color_b*t, and invert flips t so the ramp runs the other way.

Two details worth knowing before you set expectations:

  • The mask is flat. The alpha slider sets output opacity and is copied verbatim into the returned mask. So a ramp at alpha 1.0 gives you a solid white mask - the gradient lives in the RGB, not the matte. If you actually want the gradient as a mask, run the output through the pack's ImageOps Mask Convert with a luma source. That's the standard trick.
  • The control points are normalized 0–1, with (0,0) at top-left. The defaults run white at the left edge (start_x=0) to black at the right (end_x=1). You can drag start/end directly on the live preview instead of typing, which is the pleasant way to aim a radial ramp at a face.

Inputs that matter

Most of these are self-explanatory, but the ones beginners actually set: color_a / color_b (hex, pickers with the pack's eyedropper), ramp_shape (linear vs radial), the four start_x/y / end_x/y points, and ramp_mode if you want the falloff to ease. width, height, and frame_count control the plate; frame_count duplicates the gradient into a batch, which is how you get an animated gradient background for video work - every frame identical, ready to be warped or keyframed downstream.

Outputs

image, mask, and - handy for keeping your graph honest - width, height, and frame_count as INTs. Wire those into resolution-dependent nodes and you never hardcode a mismatch.

Installing it

This is part of the ComfyUI-Majoor-ImageOps pack:

cd ComfyUI/custom_nodes
git clone https://github.com/MajoorWaldi/ComfyUI-Majoor-ImageOps

Or search "ComfyUI-Majoor-ImageOps" in ComfyUI Manager. Restart ComfyUI, then hard-refresh the browser (Ctrl+F5 / Cmd+Shift+R on macOS) or the live-preview widgets won't appear. No extra dependencies, no model downloads - pure torch/numpy, so it runs on CPU if you're not on a GPU. ComfyUI ≥ 0.13.0.

Where people get burned

Mostly the mask thing - people feed the mask output into a matte expecting a gradient and get a flat white rectangle. Check alpha if that happens. And note the ranges on the control points go from -2 to 3, deliberately wider than the image, so you can push a ramp's start off-canvas to get a cleaner falloff across the frame rather than an edge-to-edge hard look.

Categoryimage/imageops

Inputs (13)

NameTypeDefaultDescription
widthINT10241–8192
heightINT10241–8192
frame_countINT11–4096
color_aCOLOR#ffffff
color_bCOLOR#000000
alphaFLOAT1.000–1
start_xFLOAT0.000-2–3
start_yFLOAT0.500-2–3
end_xFLOAT1.000-2–3
end_yFLOAT0.500-2–3
ramp_shapeCOMBOlinear2 options: linear, radial
ramp_modeCOMBOlinear4 options: linear, ease_in, ease_out, smoothstep
invertBOOLEANfalse

Outputs (5)

NameTypeDescription
imageIMAGE
maskMASK
widthINT
heightINT
frame_countINT