Nodes/ComfyUI/Invert Image Colors
ComfyUI Node Runs on cloud

Invert Image Colors

A one-line color flip, plus the alpha gotcha nobody mentions

By Comfy-Org·Created 4 years ago·Updated about an hour ago· 129,943
Invert Image Colors
  • image
  • IMAGE

If you've ever wanted to know what your render looks like as a photographic negative, this is the node. Invert Image Colors does exactly one thing: every pixel becomes 1.0 - pixel. Blacks go white, whites go black, reds go cyan, and you have a film negative on your hands with zero setup. It's the simplest node in ComfyUI's image/color group - one input, one output, no knobs to turn. Sometimes the answer really is that boring.

What it's actually for

The obvious use is aesthetics: negative images, film-scan nostalgia, glitchy intros. But the interesting uses are where you feed the inverted result back into a pipeline. Inverting line art is a classic one - if a ControlNet lineart model keeps missing your sketch because it's thin white lines on a dark background, flip it and let the model see strong dark marks on white. Same operation, completely different model behavior.

People also use inversion as a cheap img2img trick. Samplers behave differently when the starting image is inverted; it's a way to force a big tonal departure that an img2img pass at low denoise won't otherwise give you. The math keeps values inside the [0,1] range the model expects, so nothing explodes - it's just a different starting point.

How it works

The entire implementation is one line of tensor math:

s = 1.0 - image

ComfyUI holds every image as a float tensor in [0,1] - that's why subtracting from 1 works as a clean inversion. It's applied to every channel of every pixel in the batch, so a batch of images inverts as a batch. No model files, no downloads, instant on CPU or GPU.

The gotchas worth knowing

It's an IMAGE node, not a MASK node. If you're trying to flip a mask, this won't even connect - mask tensors are a different type. Use the dedicated mask-invert node for that.

Alpha gets inverted too. Load Image gives you an RGBA tensor, and 1 - image doesn't stop at RGB - it flips the alpha channel as well. If you've loaded a PNG with transparency and saved the output with alpha, you'll get exactly inverted transparency, which looks like the image "vanished." If you only care about colors, strip the alpha to RGB first (there's a core node for extracting channels). On freshly VAE-decoded renders you're fine, since those are RGB.

The search alias. If you type "reverse colors" into the node search, this is what you get. Handy, because the display name hides it under Invert Image Colors.

Where it lives

Invert Image Colors ships with ComfyUI core - it's one of the original nodes.py nodes, so it's been there since the beginning. No install, no Manager, no model files to place. You'll find it under Image → Color (in newer UIs, Image Tools). It landed so long ago that nobody thinks about it as "a node you add" - it just exists, which is exactly what you want from a one-liner like this.

Troubleshooting

If "nothing happens," double-check what you're previewing - a correctly inverted dark image can still look plausibly "normal" on a dark thumbnail. If the output looks like a weird grey soup, you're probably feeding it a tensor that isn't plain image data (like a latent or a mis-wired mask pathway). And if your inverted PNG comes back with a transparent background you didn't ask for - that's the alpha thing above, not a bug.

It's not the node you build a career on, but it's the node that shows up in everyone's workflow the moment they need a negative and don't want to reach for another app.

Categoryimage/color

Inputs (1)

NameTypeDefaultDescription
imageIMAGE

Outputs (1)

NameTypeDescription
IMAGEIMAGE