ComfyUI Node

Latent Switch (JPS)

Pick one of up to five LATENT sources with a single number

By JPS-GER·Created 3 years ago·Updated 2 years ago· 100
Latent Switch (JPS)
  • latent_1
  • latent_2
  • latent_3
  • latent_4
  • latent_5
  • latent_out
select

If your workflow branches - different sampling paths for different aspect ratios, an inpainting branch versus a plain txt2img branch, a couple of experimental sampler chains you're comparing - you eventually need one place where those branches converge back into a single LATENT before hitting the VAE Decode. That's this node's whole job.

Wire up to five latent sources to the optional latent_1 through latent_5 inputs (any you're not using can stay unconnected), set select to the slot number you want, and that latent passes through as latent_out. It's a pure router - no blending, no math on the latent tensor itself, just a gate deciding which of up to five upstream paths actually continues downstream.

It's built the same way as the rest of the pack's switch family (Model, Conditioning, Image, ControlNet all work identically), and the reason it outputs a plain slot number rather than a boolean is a deliberate design choice from the author: it lets these switches chain into each other without an extra conversion node, since some alternative switch implementations use 0/1 and need additional math nodes to bridge into anything expecting a different convention.

Where it fits. The clean use case is exactly the "multiple branches, one output" pattern: say you've got a standard KSampler chain and an alternate one using a different sampler/scheduler pair for comparison, both producing a LATENT - this switch is where they merge back into a single path before VAE Decode, and flipping select is how you A/B the two without rewiring. It's also a natural fit downstream of Enable Disable Switch (JPS) if you're synchronizing several switches (latent, model, conditioning) off one shared selector value, so picking "branch 2" everywhere is one number change instead of four.

Installing it. Through ComfyUI Manager - search "JPS Custom Nodes for ComfyUI" - or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/JPS-GER/ComfyUI_JPS-Nodes.git

Restart, find it under JPS Nodes/Switches. If you're upgrading over an existing install, delete the old copy first - the author is explicit that leaving two versions in place causes class-name conflicts. No models, no extra dependencies; it's routing references to latents already produced elsewhere in your graph.

Troubleshooting. The near-universal mistake with these switches: select needs to point at a slot that's actually connected. Wire latent_1 and latent_2 only, then set select to 3, and you get nothing rather than a sensible fallback - ComfyUI treats it as a missing input. Also worth remembering: because this node passes latents through untouched, if your branches were generated at different resolutions, switching between them won't resize anything for you; whatever comes out is whatever size that branch actually produced, so downstream nodes (VAE Decode, any upscale step) need to tolerate that if your branches aren't guaranteed to match.

CategoryJPS Nodes/Switches

Inputs (6)

NameTypeDefaultDescription
selectINT
latent_1optLATENT
latent_2optLATENT
latent_3optLATENT
latent_4optLATENT
latent_5optLATENT

Outputs (1)

NameTypeDescription
latent_outLATENT