Nodes/RC Image Compositor/RC Gradient Map
ComfyUI Node

RC Gradient Map

The fastest way to look like you know color theory

By kj863257·Created 11 months ago·Updated 10 months ago· 16
RC Gradient Map
  • image
  • IMAGE
gradient_data{"stops": [{"position": 0.0, "color": [0, 0, 0, 255]}, {"position": 1.0, "color": [255, 255, 255, 255]}]}
blend_modenormal
opacity1.00
preserve_luminosityfalse

Gradient mapping is one of those moves that reads as "this person knows color grading" when it's actually embarrassingly easy. You take the luminosity of the image - how bright each pixel is - and remap it through a color gradient. Dark pixels get the left end of the gradient, bright pixels get the right end. Done. That's the entire trick behind duotones, film-look teal-and-orange, thermal-imaging vibes, and sepia grades that look expensive.

RC_GradientMap is this pack's implementation, and it's a good one: a vectorized NumPy LUT pipeline (the node's docstring is literally bragging about np.interp()), 16 Photoshop-faithful blend modes, opacity control, and a luminosity-preservation switch. It lives in the RC Image Compositor suite under RC/Adjustments.

How it works

The node maps luminance through a gradient defined as color stops in gradient_data - JSON, defaulting to a black-to-white ramp (which produces a grayscale image, i.e. the boring baseline). Change the stops and the whole grade changes. The 16 blend modes cover everything from plain normal through multiply, screen, overlay, the dodge/burn family, and the HSL modes - so you can either replace the color outright or blend the mapped version into the original for a subtler push.

The inputs you'll actually touch:

  • gradient_data - the JSON stops. The pack's other gradient nodes (like RC Gradient Generator) produce compatible data, so you can build a fancy multi-stop ramp there and pipe it in.
  • blend_mode - how the mapped image composites over the original.
  • opacity (0–1) - overall effect strength.
  • preserve_luminosity - keep the original brightness structure and only swap the color. This is the "safe mode" that keeps a grade from flattening contrast.

Output is a single IMAGE, same dimensions, batch-safe.

Installing it

ComfyUI Manager → search "RC Image Compositor" → install → restart. Manual route if you prefer:

cd ComfyUI/custom_nodes
git clone https://github.com/kj863257/ComfyUI_RC_Image_Compositor
cd ComfyUI_RC_Image_Compositor
pip install -r requirements.txt

Dependencies are just pillow, numpy, and opencv-python. No models, no downloads, nothing heavy.

Where people get burned

  • preserve_luminosity off = your contrast gets eaten. A gradient maps brightness to color, so by definition it reflattens the tonal range. If your graded image looks flat and lifeless, that's not a bug - turn preserve_luminosity on and it stops throwing away the original contrast.
  • Hand-editing the JSON. The default payload is simple enough to read, but a multi-stop gradient with alpha values in JSON is fiddly to type blind. Build it in the pack's gradient generator or editor instead.
  • Blend mode ≠ grade quality. overlay with opacity at 0.3 beats normal at 1.0 for most photography. Treat the mode+opacity as the real controls and the gradient as the palette.

If you've never used a gradient map, this is the node to learn it on. Two minutes in, you'll have a duotone that looks like a deliberate art direction decision instead of an accident.

CategoryRC/Adjustments

Inputs (5)

NameTypeDefaultDescription
imageIMAGEInput image to apply gradient mapping
gradient_dataSTRING{"stops": [{"position": 0.0, "color": [0, 0, 0, 255]}, {"position": 1.0, "color": [255, 255, 255, 255]}]}Gradient data in JSON format
blend_modeCOMBOnormalBlending mode for gradient mapping
opacityFLOAT1.000–1Opacity of the gradient mapping effect
preserve_luminosityBOOLEANfalsePreserve original image luminosity when mapping

Outputs (1)

NameTypeDescription
IMAGEIMAGE