ComfyUI Node

Int To List

Turn one or two integers into a ComfyUI LIST

By lldacing·Created 3 years ago·Updated 8 months ago· 96
Int To List
    • LIST
    int_a
    int_b

    IntToList is the integer sibling of this pack's StringToList: give it one or two INT values and it wraps them into a single LIST. Same minimal spec both ways - one input in, [int_a] out; two inputs in, [int_a, int_b] out. Nothing fancier than that.

    It's another piece of plumbing from comfyui-easyapi-nodes, lldacing's collection of small utility nodes built around the seams ComfyUI's type system creates for anyone driving it programmatically. An INT by itself and a LIST containing one INT are different types as far as the graph is concerned, and there's no built-in promotion between them - which is exactly the gap this node fills.

    Where you'd actually use it

    The main case is feeding something that only accepts a LIST - this pack's own ForEachOpen loop node, a batching node, a filter - when what you actually have upstream are one or two plain integers rather than something that already produces a list. It's also useful for building up a combined list from a couple of individually-computed integers (say, two separately calculated dimensions or indices) before merging further lists in with ListMerge.

    You'll see this same shape - a plain scalar on one side of a wire, a LIST expected on the other - a lot once you start building graphs meant to be driven by an API caller rather than clicked through by hand. A person filling in a widget by hand never runs into it, because ComfyUI's widgets quietly handle the single-value case for you. An API request that sends back a couple of computed integers, on the other hand, hands you exactly that: two scalars, no list wrapper, and a downstream node that won't take anything else. IntToList is the one-line fix rather than something you'd write custom Python for.

    The inputs and outputs that matter

    • int_a (INT, required) - the first (and possibly only) integer.
    • int_b (INT, optional) - a second integer, appended after int_a if you wire one in.
    • Output: LIST - [int_a] alone, or [int_a, int_b] if both are set.

    How to install it

    Through ComfyUI Manager, searching comfyui-easyapi-nodes. Manual install:

    cd ComfyUI/custom_nodes
    git clone https://github.com/lldacing/comfyui-easyapi-nodes.git
    cd comfyui-easyapi-nodes
    pip install -r requirements.txt
    

    Restart ComfyUI afterward. Nothing to download beyond the pack itself.

    Common issues & troubleshooting

    Need more than two integers in the list. IntToList only takes two inputs. Chain the output into ListMerge alongside a second IntToList (or another list source) if you need to build up a longer list from more individual values.

    Expected a range or sequence, got a two-item list. IntToList doesn't generate a sequence - it's not range(). If you actually need something like "every integer from 0 to N," this isn't the node for that; it only wraps the specific values you hand it.

    Type mismatch further downstream. IntToList always produces a list of integers. If the next node in your graph expects a different element type - floats, strings - you'll need a conversion step somewhere in between; this node won't coerce for you.

    CategoryEasyApi/Integer

    Inputs (2)

    NameTypeDefaultDescription
    int_aINT
    int_boptINT

    Outputs (1)

    NameTypeDescription
    LISTLIST