Combine Multiple Latents Into Batch
Two latents in, one batched latent out
- latent1
- latent2
- LATENT
This one does exactly what the display name says and nothing more: feed it two latents, get back one latent with both stacked into a single batch. No blending, no math you need to think about - it's plumbing, and it's the kind of plumbing that saves you a second trip through the sampler. It lives in the Comfy-Photoshop-SD pack - the bridge between ComfyUI and Abdullah Alfaraj's Auto-Photoshop-SD Photoshop plugin - where sending back multiple render variants from one API call is exactly the kind of thing you'd want.
Why bother, instead of just running two generations?
Because a KSampler call has fixed overhead - model load, scheduler setup, the works - and running it once over a batch of two is cheaper than running it twice over a batch of one each. If you've generated a couple of latent starting points you want sampled with identical settings (say, one straight txt2img latent and one from an img2img encode, or two seed variants you want compared side by side), batching them here and sending the result through a single KSampler gets you both outputs in one pass instead of two.
Inputs and outputs
Just latent1 and latent2 - both required, no optional extras - combining into a single LATENT output. That output wires straight into anything that expects a batched latent: your KSampler, then a VAEDecode at the end will hand you back an IMAGE with a batch dimension of (at least) two, which most SaveImage or preview nodes will happily split into separate output images for you.
Only two inputs means this node is strictly pairwise. Need to combine three or four latents? Chain it: run APS_LatentBatch on latent1+latent2, then feed that output as latent1 into a second APS_LatentBatch alongside latent3, and so on. It's a small node with no settings to misconfigure, which is exactly what you want from a piece of plumbing you're going to wire into a bigger graph without thinking twice about it.
Installing it
Through ComfyUI Manager, search "Comfy-Photoshop-SD" and install. Or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/AbdullahAlfaraj/Comfy-Photoshop-SD
Restart ComfyUI afterward.
Where people get burned
The one rule that matters for any latent-batching node in ComfyUI, this one included: latent1 and latent2 need to be the same spatial resolution. Latent tensors carry width and height baked into their shape, and you can't concatenate two tensors of different sizes along the batch dimension - if one latent came from a 512×512 empty latent and the other from a 768×768 img2img encode, expect an error rather than a silently resized result. Match your resolutions upstream (same EmptyLatentImage/GaussianLatentImage settings, or resize before encoding) before they hit this node. Different batch sizes on the two inputs are fine - that's what batching is for - it's differing width/height that breaks it.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| latent1 | LATENT | — | |
| latent2 | LATENT | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LATENT | LATENT | — |