Nodes/comfyui_bmad_nodes/FromListGet1Latent
ComfyUI Node Runs on cloud

FromListGet1Latent

Extract One Latent From a Batch Without Re-Encoding

By bmad4ever·Created 3 years ago·Updated 9 months ago· 70
FromListGet1Latent
  • list
  • LATENT
index0

FromListGet1Latent pulls a single LATENT out of a latent list by index, at zero re-encoding cost. It's the latent member of the pack's FromListGet1* family, and it's how you grab one frame or one variant out of an encoded batch instead of re-encoding the image you actually want.

Why you'd reach for it

Latents are expensive to produce, so when you encode a batch you want to reuse it - including subsets of it. FromListGet1Latent lets you take an encoded batch, index into it, and hand one latent to a KSampler for a dedicated pass (higher detail, different seed, its own refiner) without running the VAE again. It's the natural companion to ToLatentList/ExtendLatentList: build a latent list, then pull specific entries for individual treatment.

The dynamic index matters here too. Drive index with a counter and you can iterate a batch one latent at a time through a single downstream chain - handy when your sampler only processes one latent and you don't want to duplicate the chain per item.

How it works

Same lookup as the rest of the family: index % len(list), zero-based, negative indexes count from the end. The list input is forced and expects a list of LATENT dicts (the [ ] on the socket is the giveaway). If you're feeding it a single latent batch from a VAE Encode node, that's not a list - use ToLatentList first. The index widget accepts a connection for dynamic selection. Output is a single LATENT.

Install

Part of the bmad4ever pack - one install covers it:

cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_bmad_nodes

then restart ComfyUI. Manager users search "comfyui_bmad_nodes"; the pack's Python requirements install automatically.

Common issues

  • Batch vs list again. A LATENT batch from the VAE is a tensor with a batch dimension, not a list. Convert with ToLatentList before connecting.
  • Zero-based indexes. Index 0 is the first latent; -1 is the last.
  • Wrapping behavior. Out-of-range indexes wrap via modulo, so an index past the end silently returns an early item. If you're looping, keep the index within bounds.

When you've encoded a batch you plan to use across several passes, this node pays for itself - one encoding, many isolated samples.

CategoryBmad/Lists/Get1

Inputs (2)

NameTypeDefaultDescription
listLATENT
indexINT0

Outputs (1)

NameTypeDescription
LATENTLATENT