Get Last Frame From Batch
Pull the final image out of an IMAGE batch
- images
- IMAGE
Exactly what the name says: hand it a batch of images, it gives you back just the last one. No sorting, no filtering, no options to configure - this is as close to a one-line utility as a ComfyUI node gets, and that's exactly why it's worth having instead of building the equivalent out of more general-purpose nodes every time.
How it works
An IMAGE batch in ComfyUI is a tensor shaped (batch_size, height, width, channels). This node slices out the last entry along that batch dimension - but it does it carefully, keeping the batch dimension intact rather than collapsing it, so what comes out the other side is still a proper 1-image IMAGE batch that any downstream node will accept without complaint. If what you feed it isn't a valid multi-frame batch to begin with, it just hands the input back unchanged rather than erroring.
The inputs and outputs that matter
images- the batch to pull from. That's the entire input list; there's nothing else to configure.
Output: a single IMAGE, containing just the final frame of whatever batch went in.
What it's actually for
The main use case is stitching video clips together. If you're generating a clip in pieces - say with a node like Modelscopet2v (same pack) or any other batch-frame video generator - and you want the next clip to continue smoothly instead of cutting hard, you take the last frame of clip one and feed it back in as the starting reference for clip two. This node is the piece that grabs that last frame cleanly.
It's also just handy for previewing: if you want to check how an animation batch ends without scrubbing through the whole sequence in a preview node, wire this in and look at what comes out.
Installing it
Search cspnodes in ComfyUI Manager, or clone it directly:
cd ComfyUI/custom_nodes
git clone https://github.com/cerspense/ComfyUI_cspnodes
Restart afterward. The pack is a single Python file that imports diffusers and pymediainfo unconditionally at the top - dependencies for the video-generation nodes elsewhere in the pack, not for this node specifically. If cspnodes doesn't appear in your node list at all after install, that's almost always one of those two imports failing; check the ComfyUI startup log rather than digging into this node's code.
Where people get tripped up
There's no resizing here - this is a pure pass-through of whatever frame it grabs, at whatever resolution it already was. If you're chaining it into a node that expects a specific size, pair it with ResizeByImage (also in this pack) or a standard image-scale node rather than expecting this one to handle that for you.
The other thing worth knowing: feeding it a batch of exactly one image isn't an error, it's the documented fallback path - you just get that same single image back, unchanged. So don't be surprised if it seems to do nothing when your "batch" only ever had one frame in it to begin with.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |