Any to Int
Any to Int refuses to guess — and that's the feature
- value
- int
Most converter nodes in this ecosystem quietly truncate. 59.9 becomes 59, your latent dimensions shift, and nothing tells you. Any to Int took the other road: it converts what genuinely is a whole number and raises a readable error at everything else.
That's a small design decision with a real consequence. When your workflow breaks, you find out at the converter with a message that names the value, instead of six nodes later with a shape mismatch.
It's part of Orel's Nodes, DarkOrel's utility pack - the one that exists so you stop installing a separate pack for every trivial string and number operation.
The mechanism, exactly
The input is *, ComfyUI's IO.ANY wildcard, so anything can be wired in. What happens next depends on what you sent:
- bool →
0or1 - int → unchanged
- float → accepted only if it's a whole number (
4.0→4).4.5raises: "Float 4.5 is not a whole number." - numeric STRING → parsed.
"42"works."42.0"works."42.5"raises and tells you to use Any to Float instead. - strings with a trailing percent → the
%is stripped first, so"60%"→60 - None → raises. NaN → raises. A MODEL or IMAGE tensor → raises with the type name.
Notice the percent handling: it's there for workflow scores. The face-similarity node in this same pack emits a percentage, and someone is obviously piping that into filenames. Whole-percent scores convert; "59.9%" does not, because it's not an integer. The percent strip is a convenience, not a rounding step.
Inputs and outputs
value(required, type*) - the thing being converted.- int (INT) - the result.
Where it earns its place
Feed a converted seed into anything that wants an integer, or normalise a value that arrives as a string from one branch and a number from another. In a bigger graph the second case is common: an API node hands you "1024", a primitive node hands you 1024, and the node downstream accepts only INT. One converter in the middle and both branches work without you rewiring anything.
It's also a decent sanity gate. If a score is supposed to be an int and it isn't, you want to know at the conversion rather than at the sampler.
Install
Manager → Orel's Nodes → Install → restart → hard-refresh. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/DarkOrel/Orels-Nodes.git orels-nodes
python -m pip install -r orels-nodes/requirements.txt
Restart, hard-refresh. This node needs nothing from the requirements file - it's stdlib Python. The primitives load even when the pack's optional dependencies (Hugging Face downloads, InsightFace) are missing; only the features that need them fail, and they fail with a clear message rather than a broken import at startup.
Gotchas
Errors here are loud on purpose. Don't wrap this in a "just try it" mindset. If it raises, the value genuinely isn't an integer and something upstream is off. Reach for Any to Float and decide the rounding yourself.
Booleans count as numbers. A passed boolean out of a QC gate converts to 1 or 0 without complaint. That's occasionally handy (counting passes) and occasionally a silent bug (using a boolean where you meant a seed). The node can't tell those apart.
Strings are parsed, not coerced loosely. "true", "1e3" and "sixty" all raise. "1e3" specifically goes down the float path, converts to 1000.0, and comes back as 1000 - which is arguably correct and definitely surprising the first time.
There's no rounding option. This is not the node for "just give me an int, I don't care how." If you don't care how, you want a different node.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| value | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| int | INT | — |