Nodes/opencv-comfyui/OpenCV bitwise_not_1
ComfyUI Node

OpenCV bitwise_not_1

The twin invert node — same flip, same badge number energy

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV bitwise_not_1
  • src
  • dst
  • mask
  • nparray

bitwise_not_1 is the same node as bitwise_not_0. The generator behind this pack made two wrappers because OpenCV's type stubs list cv2.bitwise_not twice (a MatLike overload and a UMat overload) and nobody deduplicated them. Identical inputs, identical output, identical behavior. If you've read _0, you've read this. If you haven't, here's the whole story in brief.

The node inverts an image: every pixel value goes to 255 minus itself. Black ↔ white, midtones become their complement. That's a photographic negative on images, and on masks it's the "select everything except this region" flip - genuinely the most common reason anyone reaches for it in a ComfyUI graph.

The inputs

  • src - the NPARRAY to invert.
  • dst (optional) - out-parameter, leave unwired.
  • mask (optional) - single-channel 8-bit; only pixels where it's non-zero get inverted, everything else is preserved.
  • Output: one nparray.

That's it. No literals, no channel-order pitfalls - inversion is channel-wise, so BGR vs RGB doesn't matter here, which makes this one of the pack's least hostile nodes.

Two things to remember

Scale. ComfyUI core masks are float 0–1; OpenCV arrays are 8-bit 0–255. This node does no auto-conversion, so a raw Comfy mask inverted here gives you a fuzzy not-quite-complement. Convert first.

Plumbing. Everything in opencv-comfyui runs on NPARRAY - Image2Nparray in, Nparrays2Image out.

Install

ComfyUI Manager → search opencv-comfyui, or:

cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
pip install opencv-python-contrib

Restart, no models to download. The pack's known install gotcha is a conflicting OpenCV build (Cannot import name 'guidedFilter' from 'cv2.ximgproc') - reinstall cleanly and move on. And for the last time: _0 and _1 are interchangeable; the numbering is an artifact of the auto-generation, not a feature.

Categoryimage/OpenCV

Inputs (3)

NameTypeDefaultDescription
srcNPARRAY
dstoptNPARRAY
maskoptNPARRAY

Outputs (1)

NameTypeDescription
nparrayNPARRAY