Nodes/ComfyUI Level Pixel/Convert Bool To String [LP]
ComfyUI Node

Convert Bool To String [LP]

Turning a toggle into readable text

By LevelPixel·Created 2 years ago·Updated 5 months ago· 31
Convert Bool To String [LP]
    • STRING
    boolfalse

    Straightforward: a boolean toggle goes in, plain text comes out. It's the reverse of StringToBool-LP, and it's what you reach for whenever a flag needs to become human-readable - a log line, a filename fragment, a text field that has no idea what a BOOLEAN socket is.

    Why you'd want this

    ComfyUI keeps BOOLEAN and STRING as separate types, and most nodes that display or save text - Show Text, a file-naming node, anything building a status message - only accept a STRING. If you've got a toggle driving some part of your workflow ("upscale enabled," "batch mode on") and you want that state to show up in a log, a saved filename, or a debug overlay, this node is the one-step bridge.

    It shows up a lot in the batch/loop automation style this pack is built around - a per-item flag that decided whether a step ran or got skipped is exactly the kind of thing worth recording in a log line or a results filename, so you can look back afterward and tell which items took which path without re-running anything.

    How it works

    This is almost certainly a direct str(bool_value) under the hood, which in Python renders as "True" or "False" - capitalized, not the lowercase true/false you'd get from JSON or most other languages. That distinction matters the moment this string feeds into something case-sensitive downstream: a text comparison, a JSON-shaped field, or a system expecting lowercase. If you hit a mismatch, that capitalization is the first thing to check.

    The inputs and outputs that matter

    • bool - the toggle to convert, default False.
    • Output - a single STRING.

    One input, one output, nothing else to configure.

    How to install it

    ComfyUI Manager: search "ComfyUI Level Pixel" or ComfyUI-LevelPixel, install, restart - auto-updates via Manager's "Update ALL." Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/LevelPixel/ComfyUI-LevelPixel.git
    

    Restart ComfyUI. Pure conversion logic, no models or extra dependencies.

    Common issues & troubleshooting

    A downstream comparison against "true" (lowercase) never matches. That's almost certainly the capitalization - Python's default str(True) gives "True", not "true". Either compare case-insensitively downstream, or run the result through a lowercase-text node before the comparison.

    You want to feed this into something expecting JSON-style booleans as text. Same root cause - JSON's true/false are lowercase and unquoted-in-source, while this node's output is a capitalized Python-style string. If you're building JSON text by hand from pieces, don't just concatenate this node's raw output; normalize the casing first, or build the JSON with ConvertStringToJson-LP/ConvertJsonToString-LP instead of string-splicing.

    You need the opposite conversion. That's StringToBool-LP - text back into a real boolean - for the other direction of this same round trip.

    CategoryLevelPixel/Conversion

    Inputs (1)

    NameTypeDefaultDescription
    boolBOOLEANfalse

    Outputs (1)

    NameTypeDescription
    STRINGSTRING