Bool -> Int
The one-line converter that keeps your workflows alive
- INT
Bool -> Int is the node you don't think about until you need it, and then you need it a lot. It takes a boolean and outputs 0 or 1. That's it. That's the whole node. Sometimes ComfyUI gives you a toggle and the thing downstream wants a number, and this is the honest little bridge that keeps the graph connected.
Why it exists
ComfyUI's type system is strict: a BOOLEAN won't silently flow into an INT socket, and plenty of nodes still want integers. Flip a checkbox, wire this node between it and, say, a batch-size calculator or a strength formula, and you get a 0 or 1 you can multiply into anything. It's also just useful for math: 1 - BoolToInt(flag) gives you a clean inverse, and combined with a More Math expression node it becomes a switch.
The pack ships the obvious siblings too - mrmth_IntToFloat, mrmth_FloatToInt, mrmth_IntToBool - so you've got the whole conversion family; this one just happens to be the one people search for. They all live under the pack's "More math" category.
Inputs and outputs
One required input, value (a BOOLEAN, default false). One output, INT. Wire the boolean in, read the integer out. Nothing to configure, nothing to forget.
Installing it
Standard for the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/mcDandy/more_math
cd more_math
pip install -r requirements.txt
Restart ComfyUI, or install "More math" from ComfyUI Manager. Dependency is antlr4-python3-runtime plus torch. No models to download - installing an entire expression-language pack to get a bool-to-int converter is admittedly a big hammer for a tiny nail, but you're likely here for the rest of it anyway.
Gotchas
There aren't many, because there's not much to get wrong. One thing worth knowing: this node (like the whole conversion family) is written against ComfyUI's newer node API, so if you're on an ancient ComfyUI build and the node won't register, update ComfyUI first. The pack is brand new and solo-maintained, and for a trivial converter that mostly means "it works, and it'll keep working." If your workflow is full of type-mismatch errors at the bool/int boundary, this is a two-second fix you'll stop noticing - which is exactly what a utility node should be.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| value | BOOLEAN | 0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| INT | INT | — |