Nodes/comfy_Pond_Nodes/🐳图像反相 (Invert Image)
ComfyUI Node

🐳图像反相 (Invert Image)

An invert button you can flip on and off without re-wiring

By Pondowner857·Created about a year ago·Updated 21 days ago· 45
🐳图像反相 (Invert Image)
  • image
  • IMAGE
invert_enabledfalse

The whole node is two inputs and one output, and that's the point. 🐳图像反相 (Invert Image) does one thing: flip every color to its complement - black becomes white, blue becomes orange, the works - and it has a boolean switch so you can keep it in the workflow and turn it on and off without deleting wires.

Why would you want a color inversion in an image pipeline? The big one is working with mask-like images the wrong way around. If some preprocessing node hands you a map where the "active" area is black instead of white, a single invert fixes the polarity before you feed it to ControlNet or a compositor. It's also the classic trick for generating negative-space art: invert a subject render to get a striking silhouette, or invert a background to inspect composition at a glance.

How it works

Boring and dependable: each frame in the batch goes through Pillow's ImageOps.invert, which produces the complement per channel. It's batch-safe, it runs in a few milliseconds, and it doesn't touch anything else about the image. The invert_enabled toggle defaults to false, so the node is a pass-through until you flip it - which is exactly why you can leave it parked in a workflow permanently.

Inputs and output

  • image - anything that outputs an IMAGE.
  • invert_enabled - boolean, default off. On = invert, off = pass through untouched.

The single IMAGE output is the result (or the original, when the toggle is off). Wire it anywhere an image goes.

One naming trap worth knowing: this node inverts images. If you want to invert a mask - turning the white selection area into the black one, which inpainting users do constantly - this node isn't the right tool, because a mask is a single-channel MASK tensor and this expects a full IMAGE. Use a dedicated mask-invert node for that. It's a small distinction that has confused plenty of people mid-workflow.

Install

It's one of the ~100 nodes in the Pond Nodes pack, so:

ComfyUI Manager → search "Pond Nodes" (comfy_Pond_Nodes)

or:

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

Restart after. This node uses Pillow only, so the heavy dependencies in that requirements file are irrelevant to it - no models, no downloads, no GPU. And the pack's usual footnote: the README documents a console-spam conflict with comfyui_HiDream-Sampler if you happen to have both installed.

Category🐳Pond/颜色

Inputs (2)

NameTypeDefaultDescription
imageIMAGE
invert_enabledBOOLEANfalse

Outputs (1)

NameTypeDescription
IMAGEIMAGE