Image Switch v2
Pick a branch, dump the VRAM, keep it moving
- input1
- input2
- image
The Image Switch v2 is the plain Image Switch with one extra lever bolted on: a Purge_VRAM toggle that flushes your video card before the switch fires. If you've ever had a workflow grind to a halt because two image branches were fighting over the same GPU, you know exactly why that lever exists. Otherwise, it's the same dead-simple "one of these two images" router as the rest of the RvTools switch family - and the author's favorite child, no less.
How it works
An integer widget, Input (default 1, min 1, max 2), picks which of input1 / input2 gets passed through to the single image output. Set 1, get input1; set 2, get input2. Nothing else happens to the pixels - no resizing, no color work, just routing.
The v2 twist is Purge_VRAM. Flip it on and, before routing, the node runs a cleanup pass: garbage collects, empties the CUDA cache, and calls ComfyUI's unload_all_models() to drop everything off the GPU. That's the nuclear option for when you're switching between heavy branches in one run - the second branch gets a clean card instead of whatever leftovers the first one left behind. It's slow (unloading and re-loading models costs time), so it's a "when you need it" switch, not a "leave it on" switch.
The inputs that matter
- Input - the 1-or-2 router. Wire it to a control value if you want to switch branches per run without touching the canvas.
- Purge_VRAM - the boolean that decides whether to flush the GPU first. Off by default; turn it on when the swap is stalling on memory.
- input1 / input2 - the two IMAGE candidates. Both are
forceInput, so they're cables-only.
The image output feeds whatever wants an image next: a VAE Decode, an upscaler, a ControlNet preprocessor, a preview node. Wire one of these in front of a shared consumer and a single widget becomes your branch selector for the whole graph.
Installing it
Part of the RvTools v2 pack - no models, no heavy builds. ComfyUI Manager → search RvTools → install ComfyUI-RvTools_v2, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/r-vage/ComfyUI-RvTools_v2
Restart and check the console for RvTools v2: Version 2.5.x. Dependencies beyond what ComfyUI ships (opencv-python, pilgram, pynvml, piexif) come through Manager automatically.
Troubleshooting
A couple of things actually bite people here:
- Unplugged branch → silent nothing. If you switch to an input that isn't connected, you get
Noneout and downstream either errors or does nothing. Switches only route what's wired in. - Purge_VRAM on all the time makes things slower. Every run pays the unload/reload tax even when nothing's under memory pressure. Leave it off and only enable it for the swap that needs it.
- Old workflows reference the dead v1 repo. The original RvTools was deleted, so Manager fails on old node names; this v2 pack renamed everything. And know that the author now points to ComfyUI_Eclipse as the successor - RvTools still runs, but Eclipse is where development moved.
- Bypassed switches behave differently. Bypass this node and ComfyUI passes input1 straight through, ignoring Input entirely. Confusing the first time you see it, very useful once you lean into it for group-based workflows.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| Input | INT | 11–2 | — |
| Purge_VRAM | BOOLEAN | false | — |
| input1opt | IMAGE | — | |
| input2opt | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |