String to Int
When your 'number' is actually text — and it bites
- INT
Every so often a text field is where your number lives. You pulled a seed out of some metadata, a filename has 512 buried in it, or a node handed you a string that's really an integer - and the next node on the wire wants an actual INT. ZeugStrToInt is the converter for exactly that moment: text in, integer out.
What it is
ZeugStrToInt lives in the zeug → Convert menu. Input text is a STRING (default "0", single-line). Output is an integer (the schema labels it INT). Give it "512", get 512. Give it " 512 " and it still works - the node strips surrounding whitespace before converting, which is a genuinely thoughtful touch because text from filenames or metadata is almost never clean.
When you'd reach for it
- Reading a number out of a filename or a metadata string so you can feed it to a sampler, a size node, or a seed box.
- Converting the output of a text-splitting or parsing step into something numeric so the graph can do math or comparisons on it.
- Taking user-entered text (like a dimension typed into a box) and turning it into a typed integer for a node that refuses strings.
It's the mirror image of ZeugIntToStr: that one gets numbers into filenames, this one gets numbers back out of text. Together with ZeugStrToFloat, these are the "text is lying about being a number" converters, and they sit in the same Convert menu.
How it works
The implementation is explicit and slightly opinionated:
result = int(text.strip())
It strips whitespace first, then does a standard integer parse. Here's the catch, and it's the one thing you must know: if the text can't be converted, the node throws a Python ValueError with a clear message - Cannot convert 'abc' to an integer. - and the whole workflow stops with an error. There's no silent fallback, no default value, no "best guess." An empty string fails. "3.7" fails. "12px" fails.
That's a feature, honestly - you want to know when text that's supposed to be a number isn't - but it means this node should go after parsing steps you trust, not after free-form user text you haven't validated.
How to install it
Ships in comfyui-zeug (German for "gear" or "stuff"), a small GPL-3.0 pack by Adrian Schubek:
- ComfyUI Manager: search
zeug, install ComfyUI-Zeug. - Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/adrianschubek/comfyui-zeug
Restart ComfyUI. Zero dependencies, no models to download - the pack only touches torch and ComfyUI's own modules.
Common issues
The error above is the main one, so treat it as expected behavior rather than a bug: when the graph dies with Cannot convert, go look at what text is actually arriving - usually it has a stray character, an empty value, or a decimal point. If the text legitimately contains a decimal like "3.7" and you want the whole number, run it through ZeugStrToFloat first, then floor or round it with a math node; don't try to make this node guess.
Beyond that, the whitespace stripping already handles the classic "filename with trailing space" failure, which is more than most converters bother with.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | 0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| INT | INT | — |