整数转布尔丨类型转换
The two-second node that unblocks your logic wiring
- 布尔
ComfyUI has a type problem that everyone hits eventually: half your utility nodes output integers, and the other half want booleans. A counter gives you a number, a comparison gives you a number, a "has value" check gives you a number - and your switch node just wants a yes/no. IntToBool is the plumbing that bridges that gap: one integer in, one boolean out.
It's from ComfyUI-QING (display name "整数转布尔丨类型转换"), one of six DataConverter-style nodes in the pack that move values between INT, STRING, and BOOLEAN. This is the sort of node nobody writes a fan post about, and it's also the sort that unblocks a workflow at 2am.
How it works
The entire mechanism is one line of Python: bool(integer). Zero becomes False, anything nonzero becomes True. That's the whole contract, and it's worth internalizing because it's not "1 means true" - it's "not-zero means true." So -3 is True, 2 is True, only 0 is False. If you're coming from a "1 is true" mental model, that's the one surprise to watch for.
One input, one output:
integer- the INT you want to test.布尔(boolean) - the result. (RETURN_NAMESis Chinese because the pack's display names are bilingual.)
Where it fits
This is a plumbing node - it exists to make the graph read as a program. The concrete pattern: you've got a DynamicIntegerIncrement (same pack) or a counter counting iterations, and you want a branch to fire only when the count is nonzero, or every N iterations. Compare the count, feed the result through this, and a condition router or an A/B switch gets the boolean it was asking for.
The other common spot is cleaning up data from a file. LoadPathText gives you strings; a length check gives you an integer; this node turns "is the length nonzero" into a boolean you can gate a pipeline on. It's the kind of node you use a dozen times across a complex graph without noticing, which is exactly why it's in a "data tools" pack rather than a flashy image pack.
Honestly? If you're a beginner, you'll probably reach for this less than you think - most of the time you can right-click and convert a widget to input instead of routing an int through a boolean. But the moment you're doing genuine conditional logic - batches, routers, loops - the int/bool mismatch stops being a corner case and becomes the thing you need this node for.
Installing
Part of ComfyUI-QING, so it installs with the whole pack. ComfyUI Manager: search "ComfyUI-QING". Or:
cd ComfyUI/custom_nodes
git clone https://github.com/GAO-SHIQING/ComfyUI-QING
cd ComfyUI-QING
python install_dependencies.py # or: pip install -r requirements.txt
Restart ComfyUI. Pure pip deps, no model downloads. China mirror: --mirror --auto. Python ≥ 3.9.
Gotchas
There's essentially one trap and it's the truthiness rule above: 0 → False, everything else → True. If you ever wire in a value and the output boolean is backwards from what you expected, check whether you assumed "1 is true" - that's the entire failure surface of this node. It's about as close to zero-risk as a node gets; the risk lives in your assumptions, not the code.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| integer | INT | 0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| 布尔 | BOOLEAN | — |