Bitwise Not π¦βπ₯
Flip a binary image's blacks and whites in one click
- nparrays
- dst
OpenCV's bitwise_not inverts every bit of an array. For a binary image, that means black becomes white and white becomes black. That's the entire node - one input, one output, no knobs, nothing to tune. It's the sort of utility that looks too boring to bother with until you're three nodes deep and realize your mask is inverted and the whole pipeline is wrong.
Why it's in every serious OpenCV set
The classic failure mode: you threshold an image and get white objects on a black background, but your downstream node expects white background with black objects (or a mask needs to be "the thing NOT detected"). Or you Canny an image and want to draw the non-edge area. One Bitwise Not fixes all of these without re-doing the threshold. In this pack, that matters a lot - the contour and connected-components nodes treat non-zero pixels as foreground, so "which side is foreground" is a decision you'll flip constantly.
The inputs
Just nparrays, an NPARRAY from the pack's To Nparray node. That's it. No thresholds, no modes, no enum dropdowns. The output dst is the inverted array, same shape, same type.
The catch you should know
Bitwise Not doesn't do anything clever with intensity. It's a literal bit flip, so on an 8-bit image 0 becomes 255 and 255 becomes 0 - but a mid-gray 127 becomes 128, not "inverted brightness." If you want a proper negative (photographic inversion), this is the wrong node; you'd want something like 255 - value. For binary masks and edge maps - which is what this pack's OpenCV section is actually about - it's exactly right.
Install
ComfyUI Manager β search ComfyUI-ArchiGraph, or:
cd ComfyUI/custom_nodes
git clone https://github.com/vincentfs/ComfyUI-ArchiGraph
Restart and run the pack's install script once so OpenCV is present. Nothing else downloads.
Verdict
You won't build a workflow around it, but you'll keep one in the back of your graph's drawer. When a mask comes out backwards - and masks do - this is the one-input fix that doesn't make you rebuild anything. Boring, and that's the compliment.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| nparrays | NPARRAY | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| dst | NPARRAY | β |