Tuple swap
Flip the two values inside a pair
- Tuple
- TUPLE
A one-job node: feed it a Derfuu TUPLE (A, B), get back (B, A). That's the entire function. It exists because tuple order is meaningful everywhere it's consumed - a size tuple is (width, height), an offset is (x, y) - and it's genuinely common to end up with the two values backwards: a Get image size fed into the wrong slots, a portrait-oriented tuple that needs to become landscape, or a downstream node that just expects the opposite order from the one you built.
How it works
It reads the two values out of the incoming TUPLE and repacks them in reverse order. No math, no rounding - pure reordering.
The inputs and outputs that matter
- Tuple (TUPLE) - the pair to reverse.
- Output: TUPLE - the same two values, in swapped order.
That's the whole node - one input, one output, nothing to configure.
Where it fits
Two common cases. First, correcting an accidental swap: you built a tuple with Value_A and Value_B in the wrong slots and don't want to rewire the source node - Tuple swap fixes it downstream in one hop. Second, deliberate reorientation: you've got a (width, height) tuple and a downstream calculation actually wants (height, width) - rotating a region, mirroring an offset, or feeding a node with the opposite convention. Pair it with Tuple debug print right after if you're not fully sure which order you actually need; printing both halves with a label is faster than guessing and re-running.
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
You swapped and it's still wrong. That usually means the order wasn't the problem - go back and check the values themselves (with Tuple debug print) rather than assuming a second swap will fix it. Two swaps just return you to the original order.
A region or paste position mirrors instead of matching. If you swap a position tuple without also swapping the corresponding size tuple (or vice versa), the two can end up describing inconsistent geometry - a rectangle anchored at the wrong corner relative to its own dimensions. Make sure size and offset tuples stay in the same convention.
Node missing after a pack update. Derfuu's tuple nodes specifically have a documented history of being deleted between versions rather than kept as labeled legacy nodes - a long-time user reported exactly this happening and said they'd stopped using the pack over it. If this node loads red in an inherited workflow, check the current repo for a renamed equivalent before assuming your setup is broken. A ModuleNotFoundError about Derfuu_ComfyUI_ModdedNodes_legacy means a duplicated folder; keep exactly one, named Derfuu_ComfyUI_ModdedNodes.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| Tuple | TUPLE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| TUPLE | TUPLE | — |