AIHub Utils Float To Int
A one-input cast node that keeps your numbers the right type
- INT
AIHubUtilsFloatToInt is exactly what it sounds like: one FLOAT in, one INT out, nothing else. It's a type-cast node, and in the otavanopisto ComfyUI-aihub-workflow-exposer pack it exists for a very specific plumbing reason - exposes hand you floats, but not every input downstream accepts a float.
Where this bites: an AIHubExposeFloat (or the pack's AIHubUtilsStrToFloat fed from a string selection) gives you a float, and you need to drive an integer port - a KSampler's seed, an EmptyLatentImage width, a batch count. ComfyUI will not quietly coerce a float into an int input; you either pass through a converter or you're stuck. This node is the converter.
The one thing to know
- value (FLOAT) → INT. The source casts with Python's
int(), which truncates toward zero - 3.9 becomes 3, not 4. No rounding, no cleverness. If the value genuinely can't be cast, the source raises aValueError("Could not convert float to integer").
That truncation is the gotcha worth remembering. If your workflow feeds a 2.99 megapixel-derived value into an integer dimension, you'll get 2 - silently. For anything where rounding matters (aspect-ratio math, tile counts), do your rounding upstream, or expect the floor.
When to reach for it
Two common spots in an AIHub workflow. First, right after a float expose: the client picks a float setting, and the node snaps it to an integer input. Second, after AIHubUtilsStrToFloat - that node turns a string selection like "512" into a float, and this turns that float into the int a width or seed port wants. It's also handy in the pack's own example pattern where a resolution selector produces a float vector that needs per-component int conversion.
Install and honest framing
Pack-standard install, no requirements:
cd ComfyUI/custom_nodes
git clone https://github.com/otavanopisto/ComfyUI-aihub-workflow-exposer
Restart ComfyUI. This is about as thin as a node gets - a one-line cast wrapped in error handling - and that's fine. If you're building AIHub workflows with numeric exposes, you'll trip over type mismatches eventually, and this is the boring, correct answer. If you're not building AIHub workflows, you almost certainly don't need it: ComfyUI's own float-to-int utilities exist in other packs, and a cast node is a cast node. Grab it only when you're already in the pack for the expose system.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| value | FLOAT | 0.00 | The float to convert to an integer |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| INT | INT | — |