Nodes/ComfyUI-JDCN/LogicUtil_Invert Basic
ComfyUI Node

LogicUtil_Invert Basic

The one-input NOT gate that ends your boolean tangle

By daxcay·Created 2 years ago·Updated about a year ago· 159
LogicUtil_Invert Basic
  • input1
  • *

Sometimes the whole workflow hinges on a single "not". You want to run a branch only when a mask isn't present, fire a fallback when a sampler's boolean comes back false, or flip whatever condition your other logic nodes are chewing on. LogicUtil_Invert Basic is that flip: one input in, one truth value out, with the boolean inverted.

How it works

It shows up under the LogicUtil menu in ComfyUI, and despite the "Basic" in the name it's the node you'll actually wire up when you're trying to get a conditional graph to stop doing the opposite of what you meant. In the source it's dead simple: the input is input1 (typed as *, so it accepts anything), and the output is whatever the opposite of input1 is. Feed it a True, you get False. Feed it a nonzero number or a non-empty string, you get False. Feed it 0, an empty string, or None, and you get True.

What people get wrong: this is a truthiness invert, not a bitwise or arithmetic one. It doesn't negate numbers - that's what LogicUtil_Negate Value is for. If you feed it a float like 0.7, you get False, because 0.7 counts as truthy. If your downstream node actually needs the original value back, invert is the wrong tool. Invert Basic is for boolean routing: stick it between a comparator and a switch, or chain it with the AAndB/AOrB gates, and you can build if/else behavior that ComfyUI's built-in nodes won't give you without a fight.

Worth knowing before you build a whole decision tree around it: the gates and inverters in this family are a port of aria1th/ComfyUI-LogicUtils bundled into the JDCN pack, and JDCN's README documents almost none of them - it's all about the file and latent batch nodes. So when the graph shows LogicUtil_Invert Basic, that's the same node by a different package.

Install

Install is the same as the rest of the pack: ComfyUI Manager → "Install Custom Node" → search JDCN → install → restart. By hand:

cd ComfyUI/custom_nodes
git clone https://github.com/daxcay/ComfyUI-JDCN
cd ComfyUI-JDCN && pip install -r requirements.txt

The only dependency is piexif, so there's nothing heavy to babysit. If a workflow you grabbed won't load, the missing node is usually a different pack's - the usual fix is letting Manager sort out the imports before you blame the invert gate.

CategoryLogicUtil

Inputs (1)

NameTypeDefaultDescription
input1*0

Outputs (1)

NameTypeDescription
**