Nodes/ComfyUI-TinyBee/Boolean to Int
ComfyUI Node

Boolean to Int

Turning a checkbox into a number (and why you'd bother)

By TinyBeeman·Created about a year ago·Updated 10 days ago· 1
Boolean to Int
    • integer
    booleanfalse

    This is the smallest node in ComfyUI-TinyBee, and it does exactly one thing: a BOOLEAN input in, an INT out - 1 when the box is checked, 0 when it isn't. No options, no surprises, no API call. If that sounds pointless, think about the last time you wanted to conditionally change a value in a workflow and had to build a whole switch node to do it.

    The trick is that lots of things downstream of a boolean aren't boolean-shaped. Maybe you want a checkbox that adds 200 pixels to a crop when on, or a toggle that shifts a prompt weight, or a flag that multiplies a denoise value. You can't feed a BOOLEAN into an arithmetic or integer node directly - well, some wildcard nodes will take it, but then you're relying on whatever they do with a True. TinyBee's Boolean to Int makes the conversion explicit, and explicit is the entire game in this pack: one type in, the matching type out, no hidden behavior.

    What you'd actually wire it into

    The honest use cases are math and concatenation. Boolean to Int feeding an arithmetic node gives you a clean "if checked, apply this offset" without touching a switch. Feed it into a filename string node and you get a 0/1 tag you can grep for later. It also plays well with the rest of the TinyBee casting family - Int to Boolean, Int to Float, Float to Int - so you can chain Boolean → Int → Float and get a checkbox driving a float widget's value. It's plumbing, in other words. Nothing here touches pixels.

    The one trap to watch: the output is a plain INT, not a boolean. If the thing you're feeding actually needs a boolean (some node inputs will take an int but treat 0 as false), you're fine - but if you see a type mismatch, remember this converts one way. For the trip back, TinyBee has Int to Boolean (returns True for any non-zero), so the round trip is two nodes, not one.

    Install and gotchas

    It ships inside ComfyUI-TinyBee, so you're installing the whole pack to get this one node. Easy path: ComfyUI Manager → search "ComfyUI-TinyBee" → install → restart. Or the manual route:

    cd ComfyUI/custom_nodes
    git clone https://github.com/TinyBeeman/ComfyUI-TinyBee
    # then restart ComfyUI
    

    The README claims everything is Python standard library, but the shipped requirements.txt actually lists pillow and jsonata - they're small, and ComfyUI Manager handles them automatically. There are no model files to download, which is the nice thing about a utility pack like this. This node is genuinely one line of logic (1 if boolean else 0), so there's no real failure mode to troubleshoot beyond the type mismatch above and ComfyUI's usual "did you restart after installing" ritual.

    One more note: it's a casting node, so it's in the 🐝TinyBee/Casting category in your node menu - that's where you'll find its siblings like Null To String and Empty String To Null when you go looking.

    Category🐝TinyBee/Casting

    Inputs (1)

    NameTypeDefaultDescription
    booleanBOOLEANfalse

    Outputs (1)

    NameTypeDescription
    integerINT