Nodes/comfyUI-tool-2lab/input or convert int 输入或转换整数
ComfyUI Node

input or convert int 输入或转换整数

One integer, three sockets — the pack's tiny type converter

By AI2lab·Created 2 years ago·Updated 2 years ago· 23
input or convert int 输入或转换整数
    • int
    • float
    • string
    int0

    ComfyUI is picky about types in a way that drives newcomers up the wall. A sampler wants an INT for its seed, a weight input might want a FLOAT, and some text-based node wants the same number as a STRING. This node is the workaround: you type one integer, and it hands you that value as an INT, a FLOAT, and a STRING all at once. Three sockets, one source of truth.

    You'll reach for it the moment you find yourself typing the same number into three nodes and praying they stay in sync. Set the value once here, wire the right socket into each consumer, and when you change it you change it everywhere. It's the classic "single source of truth" move that keeps a workflow maintainable, and it's the same idea behind the PrimitiveNode you may already know from ComfyUI's core.

    The inputs and outputs that matter:

    • int - the only input, default 0, spanning the full signed 64-bit range. Type your number here.
    • int (INT) - the raw value, for seed sockets and anything else that wants an integer.
    • float (FLOAT) - the same value as a float, for strength/CFG-style inputs. 3 becomes 3.0, so nodes that expect a decimal won't reject it.
    • string (STRING) - the value as text, "3", for string-typed inputs.

    Because it's flagged as an output node you can run the graph and have it count as terminal work, but that's a side detail - the point is the type conversion. The value range (up to ±1.84e19) is just the 64-bit integer ceiling; you'll never touch it, but it means even absurdly large seeds survive the trip.

    This is a genuinely useful little node, with one caveat: it's redundant with core ComfyUI. You can get an int→float→string conversion from the built-in primitives and a couple of standard nodes without adding a pack. The reason to use this one is consistency - if you're already running the 2lab bundle and you want a workflow that doesn't depend on three different packs, this keeps your graph self-contained. That's a real argument when you're assembling a workflow you plan to share.

    Installing it

    Part of AI2lab/comfyUI-tool-2lab. Install via ComfyUI Manager (search "comfyUI-tool-2lab") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/AI2lab/comfyUI-tool-2lab
    

    then restart ComfyUI. Light requirements (qrcode, Pillow, numpy, torch), no models to fetch.

    Common issues

    The main trap is expecting type coercion that doesn't exist. The FLOAT output is the integer rendered as a float - it won't carry decimals, so if you feed it 5 you get 5.0, not 5.25. And the STRING output is the raw digits with no formatting; a downstream node expecting a quoted or padded string will see exactly "5". There's also the classic wiring mistake of feeding the INT output into a FLOAT-only socket and getting a type error - that's what the float socket is for, use it. Documentation for the pack is thin (a Chinese README aimed at the 2lab publishing platform), so this node's behavior is simple enough that you likely won't need more than what's here.

    Category🦊2lab/util/number

    Inputs (1)

    NameTypeDefaultDescription
    intINT0-18446744073709550000–18446744073709550000

    Outputs (3)

    NameTypeDescription
    intINT
    floatFLOAT
    stringSTRING