ComfyUI Node

String To Int (Soze)

Text to a whole number, for seeds, indexes, and sizes

By SozeInc·Created 2 years ago·Updated 5 days ago· 10
String To Int (Soze)
    • INT
    string0

    The third of this pack's type-bridging trio, alongside String To Bool and String To Float. ComfyUI won't let you wire a STRING output into an INT input directly, and a lot of what you actually want to control with whole numbers - a seed, a batch index, a width or height - often arrives as text from somewhere else in the graph. This node closes that gap.

    The input and output that matter

    • string - the text to convert, default "0".

    Output is a single INT.

    Where it fits

    The clearest example inside this same pack: String Splitter can peel a numeric prefix off a structured filename ("0042_subject.png" split on "_" gives you "0042" as text). That's still just a string - to actually use it as a seed, a batch index, or feed it into Load Videos From Folder's index input, it needs to become a real INT first. This node is that last step. The same pattern applies to anything numeric arriving from a JSON Value Parser, a CSV row, or a config file - text in, whole number out, one hop before it reaches whatever actually needs the number.

    It's worth noticing what this node is not: it has no min/max clamp, no step, none of the range controls a normal INT widget shows you. It's a pure conversion, so if the value driving a seed or an index needs to stay inside a sane range, that guardrail has to live somewhere else in your graph - either upstream, in whatever's generating the text, or downstream, in the widget actually consuming the INT.

    Installing it

    ComfyUI Manager: search ComfyUI_Soze. Manual: cd ComfyUI/custom_nodes && git clone https://github.com/SozeInc/ComfyUI_Soze.git, pip install -r ComfyUI_Soze/requirements.txt, restart. No dependencies beyond the pack.

    Common issues

    Keep the source text strictly whole-number. If a float-looking string like "1.5" sneaks in, don't assume it'll round the way you expect - verify with a console check or a Preview node the first time you wire a new source through this. As with its float sibling, this node has nothing to configure beyond the input string, so almost every problem traces back to what's arriving here, not a setting on the node itself.

    The other place this bites: leading zeros. A filename-derived index like "0042" converts to the integer 42, which is almost always what you want - but if you were relying on the zero-padded text elsewhere in the same graph (say, to keep filenames sorting nicely), remember that padding is gone the moment it passes through here. Keep the original text string around separately if you still need it for display or naming, and use this node's INT output only for the actual numeric logic.

    CategorySoze Nodes

    Inputs (1)

    NameTypeDefaultDescription
    stringSTRING0

    Outputs (1)

    NameTypeDescription
    INTINT