Convert Bool To Int [LP]
Turning a checkbox into 0 or 1
- INT
The simplest node in this whole pack, and it's simple on purpose: it takes a boolean toggle and turns it into 1 (true) or 0 (false), so a checkbox-style value can go anywhere a plain integer is expected.
Why you'd want this
Booleans and integers are functionally interchangeable in most programming, but ComfyUI's sockets don't blur that line - a BOOLEAN output won't plug into an INT input. That matters whenever you're driving math with a toggle: "add one extra step if HiRes fix is enabled," "multiply batch size by this flag," or feeding a checkbox's state into a node that only accepts numeric input rather than a proper boolean socket. This node is the one-step bridge for exactly that.
It shows up most in automation-flavored graphs - the kind of loop-and-condition workflows this whole pack leans toward - where a toggle earlier in the graph needs to influence a numeric calculation later on without a human clicking anything mid-run. A batch-processing pipeline that skips a step for half its inputs and runs it for the other half, driven by a per-item flag, is exactly the shape of problem this node quietly solves.
How it works
It's the direct Python equivalent of int(bool_value) - True becomes 1, False becomes 0. No configuration, no alternate mapping, nothing to get wrong.
The inputs and outputs that matter
- bool - the toggle, default
False. - Output - a single INT, either
0or1.
How to install it
ComfyUI Manager: search "ComfyUI Level Pixel" or the repo ComfyUI-LevelPixel, install, restart - updates automatically through Manager's "Update ALL." Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/LevelPixel/ComfyUI-LevelPixel.git
Restart ComfyUI. Nothing beyond the base pack is needed.
Common issues & troubleshooting
There's genuinely not much that goes wrong here - it's about as low-risk a node as you'll find. The one thing worth flagging: the default state is False (outputs 0). If you drop this node and leave it unconnected to anything upstream expecting it to represent "on" by default, double-check the widget itself - an unset toggle reads as off, not on, which occasionally surprises people building conditional math where they assumed the "natural" default was true.
Beyond that, if you're doing more than a simple on/off-to-number swap - say, mapping true/false to two arbitrary numbers instead of strictly 0 and 1 - this node won't do that for you; you'd want a small math or switch node downstream to remap 0/1 into whatever values you actually need.
Worth knowing what this node is not, too: it doesn't reverse-convert. If you've got an INT and need a BOOLEAN back out the other side (say, "is this value nonzero"), that's a different node's job - this pack's own README lists a whole family of conversion nodes covering nearly every pairing (IntToBool, IntToFloat, FloatToInt, StringToBool, and so on), so check the sibling list before assuming you need to write custom logic for a conversion that's already been done for you elsewhere in this same pack.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| bool | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| INT | INT | — |