Nodes/Comfyui-JSON-Manager/Binary Index Decoder
ComfyUI Node

Binary Index Decoder

Turn a 0–7 Index Into Three Boolean Flags

By ethanfel·Created 8 months ago·Updated 5 months ago· 3
Binary Index Decoder
    • flag_0
    • flag_1
    • flag_2
    index0

    BinaryIndexDecoder is the "I need exactly this and nothing else" node in the Comfyui-JSON-Manager pack. You feed it one integer between 0 and 7 and it hands back three boolean flags. That's the whole job, and it does it entirely on your machine - no server, no JSON, no network.

    Why you'd reach for it

    Whenever you want to gate three things in a workflow from a single choice - say, "which optional passes run" - you have two options: three separate toggles, or one number that encodes the combination. This node is the latter. It treats the input as a 3-bit binary number and decodes each bit into a flag:

    • 0 → all three flags off
    • 1 → only flag_0 on
    • 2 → only flag_1 on
    • 3flag_0 and flag_1 on
    • 4 → only flag_2 on
    • 7 → all three on

    So in a video or image pipeline you can drive three on/off decisions (enable a ControlNet, run an upscaler pass, swap a conditioning branch) from one clean selector widget instead of a tangle of converters. It's the kind of utility that looks trivial until you actually want it, then it saves you a couple of nodes every single time.

    How it works

    There's no magic here. Each flag is just (index >> bit) & 1 in Python - reading one bit of the input. Because it's a plain integer math node, it runs instantly and works even when the rest of the pack can't: unlike the Project nodes in this pack, which need the companion NiceGUI manager running, BinaryIndexDecoder is fully offline.

    Inputs and outputs

    Only one input matters:

    • index (INT, default 0, min 0, max 7) - the value to decode. The widget clamps you to 0–7 because three bits is all you get.

    Outputs are the three flags, all BOOLEAN:

    • flag_0, flag_1, flag_2 - the decoded bits. Wire them into any node that takes a boolean toggle, or convert them where a node only accepts INT/FLOAT.

    How to install

    It ships inside Comfyui-JSON-Manager, so install the pack:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/ethanfel/Comfyui-JSON-Manager ComfyUI-JSON-Manager
    

    Then restart ComfyUI. Or open ComfyUI Manager and search for "ComfyUI JSON Manager" - same result. There are no model downloads and no requirements.txt for the node side; everything this node needs is Python's standard library. The manager's heavy dependencies (NiceGUI, graphviz) are only for the separate web dashboard, not for this utility.

    Common issues

    Honestly, there's not much to break. The classic mistake is forgetting it's a bitmask: 2 and 3 are different states (bit 1 on, versus bits 0 and 1 both on), so if a toggle "isn't responding," double-check the index you're feeding rather than the wiring. And if you need more than three flags, this node tops out at 7 - you'd need a second instance or a different approach. Minor, but real.

    The bigger picture: this is the pack's one node you can use in complete isolation. Everything else in Comfyui-JSON-Manager assumes you're also running the author's project manager. This one just works.

    CategoryJSON Manager/utils

    Inputs (1)

    NameTypeDefaultDescription
    indexINT00–7

    Outputs (3)

    NameTypeDescription
    flag_0BOOLEAN
    flag_1BOOLEAN
    flag_2BOOLEAN