Nodes/MdColorMod/Color Invert (MD)
ComfyUI Node

Color Invert (MD)

Three ways to invert an image, and why you'd pick any of them

By MdONeilsl·Created 2 months ago·Updated 2 months ago· 0
Color Invert (MD)
  • image
  • mask
  • image
typeRGB

Inversion is the color operation everyone thinks they understand, and mdColorInvert exists to remind you that "invert" has three different answers. The node is GIMP's Colors → Invert with its three modes, and the mode you pick changes the result more than you'd expect.

The three modes

  • RGB (default) - the naive one: 1 - value on each channel independently. Red becomes cyan, white becomes black, and a mid-gray stays put. Fast, and correct for a lot of uses - but because it's per-channel on gamma-encoded values, the result is a bit "off" physically: a bright red inverts to a cyan that's darker than it should be.
  • Linear - the physically-honest version: the image is converted sRGB → linear, inverted in linear light, converted back. This produces a lighter, more neutral inversion - the one that actually looks like the photographic negative of the original. If you're inverting for a film-negative look or feeding a color-managed pipeline, this is the one.
  • Value - inverts only the value channel of HSV, leaving hue and saturation untouched. This is the creative trick: colors keep their identity, they just flip in brightness. Dark sky becomes bright sky with the same hue - a weird, occasionally gorgeous effect, and also a fast way to get a "false color" look without a model.

What to use it for

Beyond the obvious "I want the negative," inversion has real workflow jobs. The mask input makes it a regional tool: invert just the sky, or invert the subject to make it pop. It's also a classic mathematical move - inverting before a blend or using an inverted pass as a high-pass reference. And for stylized output, Value inversion is the sleeper: flip a moody render to bright and eerie with one mode change.

The interface

  • type - the mode dropdown (RGB, Linear, Value).
  • image in, image out, optional mask (per-pixel blend: output = original * (1 - mask) + inverted * mask).
  • RGB and RGBA both supported, alpha passed through untouched, batches chunked for VRAM.

One honest note: for most beginners, RGB inversion is what you want - Linear only visibly differs on saturated, bright images, and the difference is "more neutral, slightly lighter." If your inverted output looks too heavy, try Linear before you reach for anything more complicated.

Installing

Same routine as every MdColorMod node:

cd ComfyUI/custom_nodes
git clone https://github.com/MdONeilsl/ComfyUI-MdColorMod

or ComfyUI Manager → "MdColorMod", restart. No Python dependencies (empty requirements.txt), pure torch, no model files, GPL-3.0. Young pack - if Manager hasn't indexed it, the manual clone is the reliable path.

Categorymd/image/color

Inputs (3)

NameTypeDefaultDescription
imageIMAGEInput image tensor.
typeCOMBORGBInversion method: RGB per channel, Linear negative, or HSV value inversion.
maskoptMASKOptional mask to restrict the adjustment area.

Outputs (1)

NameTypeDescription
imageIMAGEThe inverted image.