ComfyUI Node Runs on cloud

Tuple to ints

Unpack a pair into clean whole numbers

By Derfuu·Created 3 years ago·Updated 2 years ago· 455
Tuple to ints
  • Tuple
  • INT
  • INT

This is the node you reach for at the end of a Derfuu tuple-math chain, almost every time. You've computed a size or a position with Tuple, Tuple multiply, maybe Tuple swap, and now it needs to land on an actual ComfyUI node - an empty latent's width/height, an image resize, a paste offset - and those overwhelmingly want plain INT widgets, not Derfuu's TUPLE type and not floats. Tuple to ints unpacks the pair and casts each half to an integer in one step.

How it works

It reads the two values out of the incoming TUPLE, converts each to an integer, and returns them as two separate outputs in the same order they were packed. It's the same unpacking Tuple to floats does, plus the int cast - so if your tuple math left you with 1023.7 and 768.2, you get 1023 and 768 out, not rounded up or down deliberately, just truncated the way a float-to-int cast normally works. If you specifically need rounding rather than truncation, round before this node - Tuple's own round_ option (Yes/Ceil/Floor) or this pack's standalone Ceil/Floor nodes applied earlier in the chain - rather than relying on this node's cast to do it for you.

The inputs and outputs that matter

  • Tuple (TUPLE) - the pair to unpack.
  • Two outputs, both INT - the first and second component, in order, cast to whole numbers.

Where it fits

This is the exit ramp from Derfuu's tuple sub-language back into native ComfyUI. Build a (width, height) or (x, y) tuple, run it through whatever math you need - scale it, swap it, feather-adjust it - and unpack here right before it reaches an EmptyLatentImage, an ImageScale, or any node with plain integer width/height/x/y fields. It's the node that makes the whole tuple detour actually pay off: you got to compute the size parametrically, and this is where that computation rejoins the rest of the graph as ordinary numbers everything else understands.

How to install it

ComfyUI Manager: search Derfuu_ComfyUI_ModdedNodes, install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/Derfuu/Derfuu_ComfyUI_ModdedNodes

then restart. No dependencies, no models - plain Python.

Common issues & troubleshooting

A size came out one pixel/unit smaller than expected. That's the truncation, not a rounding bug - casting 1023.9 to int gives 1023, not 1024. If you want conventional rounding, apply it earlier in the chain (Tuple's round_ setting, or Ceil/Floor) before this node does its cast.

Values in the wrong socket. Order is positional - first INT output is whatever was packed first. If width and height (or x and y) look swapped downstream, check the packing order or insert a Tuple swap before this node rather than assuming a bug here.

Dimensions the model rejects. Many diffusion models want width/height divisible by 8 or 64. An int cast alone doesn't guarantee that - if your source math didn't account for it, you can still get a clean-looking integer that's still an invalid generation size.

Node missing after a pack update. Derfuu's tuple nodes specifically have a documented history of disappearing between versions with no legacy fallback kept - a long-time user reported this happening and stopped relying on the pack over it. If this node loads red in an old workflow, check the current repo for a renamed equivalent before assuming your install is broken. A ModuleNotFoundError about Derfuu_ComfyUI_ModdedNodes_legacy means a duplicated folder; keep exactly one, named Derfuu_ComfyUI_ModdedNodes.

CategoryDerfuu_Nodes/Tuples

Inputs (1)

NameTypeDefaultDescription
TupleTUPLE

Outputs (2)

NameTypeDescription
INTINT
INTINT