Batch Last Image
The last frame, plucked straight off the batch
- images
- image
Every so often you just need the last image out of a batch - the final frame of a generated video, the last of a grid of samples - and you need it as its own IMAGE you can save or process. Batch Last Image is that node. It takes an image batch, keeps only the last frame, and hands it back. The entire implementation is images[-1:], and honestly that's the whole point: it's a two-second convenience that saves you from building a fussy index-and-slice subgraph every time.
How it works
ComfyUI represents an image batch as a tensor with shape [batch, height, width, channels]. This node slices the first dimension to grab just the final entry - images[-1:] - and importantly it keeps the batch dimension, so the output is still a valid IMAGE tensor (batch of one) that every image node accepts. No shape surprises, no transpose acrobatics.
Inputs and outputs
images(required) - any IMAGE batch: a loaded video, a batch of sampled frames, a stack of generations
Output: a single image - the last frame.
Where you'd actually use it
Video pipelines are the natural home. Load a video, process its frames, and you often want the final frame as a still - for a thumbnail, for a prompt-relevant reference, or to feed back into an image-to-video pass as the "current state." It also pairs neatly with the pack's VideoLengthFromBatch if you're building "how long is this, and what's its last frame" logic. And for batch image generation, it's a cheap way to isolate the last candidate for inspection instead of eyeballing a whole grid.
There's no index parameter - it's hardwired to the last position. If you need an arbitrary frame, use a general batch-index node instead; this one is deliberately single-purpose.
Install
Pack install via ComfyUI Manager (search "Latent Astronaut Suite") or:
cd ComfyUI/custom_nodes
git clone https://github.com/latentastronaut/comfyui-latent-astronaut-suite
Restart. No dependencies beyond stock ComfyUI - it's a pure torch slice, so there's basically nothing to go wrong. The only "trap" is feeding it a single image, which works fine (you get the same image back), or expecting it to give you the last sample when you've batched multiple images per sample - it gives you the last entry of the batch, full stop.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |