Nodes/ComfyUI Ino Nodes/Ino Cast Any To Int
ComfyUI Node

Ino Cast Any To Int

Turn almost anything into an integer — the adapter node that unblocks your wiring

By nobandegani·Created about a year ago·Updated 2 months ago· 6
Ino Cast Any To Int
  • input_any
  • int

Every ComfyUI user hits the wall where a node needs an INT and you're holding a string that says "512". Ino Cast Any To Int is the adapter for that moment: it takes any input, calls Python's int() on it, and outputs the result as a proper INT. The description: "Casts any input value to an integer."

It's one of the pack's six cast helpers - string, int, model, clip, VAE, controlnet - and the int one is the workhorse. When the graph refuses to connect a wire because the types don't line up, this is the node that shrugs and makes it work.

How it works

The input is typed * (any type). At execution it runs the value through int(), so a numeric string like "512" becomes 512, a float like 3.9 becomes 3 (Python truncates, it doesn't round - a detail that bites people), and an actual int passes through untouched. The output int is a real INT for downstream nodes. It's instant and stateless.

Inputs and outputs

  • input_any - whatever you've got: a string from a file node, a float from a resolution calculator, an int that lost its typing through an any-typed hop.

Output: int - the cast value.

Where it wires in

Anytime a node demands an INT and the source isn't one. The classic cases: a string output from a filename or config node that actually contains a number, a float from a dimension calculation that you need as an integer input, or recovering a proper INT after a value passed through a wildcard-typed node. Feed the result into InoCompareInt, a size input, a batch counter - anywhere the type checker was complaining.

Installing it

Part of ComfyUI-InoNodes. ComfyUI Manager → search "ComfyUI Ino Nodes" → install → restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/nobandegani/ComfyUI-InoNodes
cd comfyui_ino_nodes
pip install -r requirements.txt

Restart after. No keys, no models.

Common issues

Two gotchas, both from how int() works. First, floats are truncated, not rounded: 3.9 becomes 3, which surprises people who expected 4. If you need rounding, use the pack's float helpers first (InoFloatToInt has round/floor/ceil) and cast after. Second, a string that isn't a clean number - "512px" or "12.5" - will fail at execution because int("512px") throws. The cast is a type fix, not a parser; clean your strings before you cast. Keep both in mind and this is the smoothest little node in the pack.

CategoryInoCastHelper

Inputs (1)

NameTypeDefaultDescription
input_any*

Outputs (1)

NameTypeDescription
intINT