Convert to Boolean
Convert to Boolean (ConvertAny2Boolean) — ComfyUI-LogicUtils
- input1
- BOOLEAN
The moment you start building any kind of branching in a ComfyUI graph, you need a clean true/false to branch on. Trouble is, the value you've got is usually a number, or a string, or the output of some other node, and the switch you want to feed expects a proper BOOLEAN. This node is the little adapter in between: give it anything, get back true or false.
It works on plain truthiness, the same rule most programming languages use. Zero, an empty string, nothing-there all read as false; basically everything else reads as true. So you can take a count, a flag someone passed in, a computed number, whatever, and collapse it down to the yes/no a conditional node actually wants. On its own it does nothing exciting. Its value is entirely as the piece that lets two other nodes talk, which is the recurring job of the whole conversion family in this pack.
ConvertAny2Boolean is part of ComfyUI-LogicUtils, the logic-and-math collection from aria1th (the AngelBottomless handle, the trainer behind Illustrious XL). It's a personal utility pack, deliberately minimal, so the nodes are small and the docs are thin.
Inputs and outputs
One input, input1, typed * (the wildcard, so it accepts anything) with a default of 0. One output: a BOOLEAN. Feed it a value, it evaluates the truthiness, out comes true or false. There are no other settings.
The natural place this output goes is the condition input of a selector like LogicGateEither, or any node in a workflow that toggles on a boolean. Think of it as the translator that sits just before a decision.
Installing it
- ComfyUI Manager: search "ComfyUI-LogicUtils" in Custom Nodes Manager, install, restart.
- Manual:
cd ComfyUI/custom_nodes && git clone https://github.com/aria1th/ComfyUI-LogicUtils, then restart.
No models and no serious dependencies. The pack ships an opt-in dependency installer behind COMFYUI_LOGICUTILS_AUTO_INSTALL=1 (turn it off hard with COMFYUI_LOGICUTILS_SKIP_INSTALL=1), but converting a value to a boolean needs nothing extra.
Watch out for
The truthiness rule is where people occasionally get surprised. A string like "false" is a non-empty string, so it evaluates to true, not false, because Python is looking at "is there text here" and not at what the text says. Same with the string "0": it's non-empty, so it's truthy, even though the number 0 is falsy. If you're passing text in, know that only a genuinely empty string counts as false.
Otherwise this is about as boring and reliable as a node gets, which is exactly what you want from a type adapter. It converts, it gets out of the way, and the interesting logic happens in whatever it feeds.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| input1 | * | 0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BOOLEAN | BOOLEAN | — |