Nodes/comfyui_io_helpers/TypeConversion(IOHelpers)
ComfyUI Node

TypeConversion(IOHelpers)

STRING, INT or FLOAT? This node converts — but feed it carefully

By Ryuukeisyou·Created 2 years ago·Updated 2 years ago· 2
TypeConversion(IOHelpers)
    • STRING
    • INT
    • FLOAT
    input_type
    output_type
    string_value
    int_value
    float_value

    ComfyUI's wires are strongly typed. An INT output won't happily drop into a FLOAT widget, and a number you want to treat as text needs an explicit step. TypeConversion(IOHelpers) is that step: a small three-way converter that turns STRING into INT, INT into FLOAT, or any pairing in between.

    You'll reach for it when the math node gives you a FLOAT but the seed or step widget you're feeding wants an INT, or when a string from a text node is actually a number you need to do arithmetic on. It's not glamorous - it's the duct tape that keeps strongly-typed graphs from fighting you.

    How it works

    You tell it two things: which type you're feeding in and which type you want out. It picks up only the value widget that matches your input_type, runs Python's conversion (str(), int(), or float()) on it, and returns all three output wires - the converted one carries your value, the other two are inert placeholders. If output_type is INT, only the INT output matters; the STRING and FLOAT outputs are just there so the signature is uniform.

    Inputs and outputs

    • input_type - STRING, INT or FLOAT. Which value widget gets read.
    • output_type - STRING, INT or FLOAT. What you want out.
    • string_value / int_value / float_value - the three optional value inputs. Fill the one matching input_type.

    Outputs: STRING, INT and FLOAT - wire the one that matches output_type, ignore the rest.

    Installing it

    Part of the same single-file, dependency-free pack from GitHub user Ryuukeisyou - no requirements.txt, no models, nothing to download beyond the repo. ComfyUI Manager → search "comfyui_io_helpers" → install → restart, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Ryuukeisyou/comfyui_io_helpers
    

    Restart ComfyUI; it's under "io_helpers".

    Common issues - this node rewards care

    • Only the value matching input_type is read. The other two widgets are ignored entirely. Set input_type to INT and it reads int_value, period.
    • STRING → INT is pickier than it looks. The conversion is Python's int(), which rejects anything that isn't an integer literal. "3" converts fine; "3.7" raises a ValueError and kills the queue. Convert to FLOAT first if your string might contain a decimal.
    • Empty widgets become None - and None bites. int(None) and float(None) crash with a TypeError. And str(None) doesn't error - it produces the literal four-character string "None", which will silently poison whatever consumes it. Type a real value into the matching widget; "empty" is not a safe default here.
    • FLOAT → INT truncates, it doesn't round. 3.7 becomes 3. If you need rounding, round before converting.

    It's the fiddliest node in the pack, but when a graph is fighting you over types, it's exactly the tool to have around.

    Categoryio_helpers

    Inputs (5)

    NameTypeDefaultDescription
    input_typeCOMBO3 options: STRING, INT, FLOAT
    output_typeCOMBO3 options: STRING, INT, FLOAT
    string_valueoptSTRING
    int_valueoptINT
    float_valueoptFLOAT

    Outputs (3)

    NameTypeDescription
    STRINGSTRING
    INTINT
    FLOATFLOAT