Get Last Frame
Grab the final image out of a video batch
- frames
- image
When a video node hands you a tensor, it's not one image - it's a batch of them stacked as [frames, height, width, channels], and most downstream nodes in ComfyUI treat that as "one image that happens to be tall" or just choke. GetLastFrame exists to pull the single last frame out of that stack and hand it to you as a proper one-frame image. It's the boring, obvious utility that saves you a headache every single time you've rendered a clip and want to do something with just its ending.
When you actually reach for it
Any workflow that generates video and then needs a still. You generate with an AnimateDiff or a cloud Veo node, and you want the final frame - the "after" state of the scene - to feed into an upscaler, a VAE decode check, an img2img pass, or just to save as a thumbnail. Same story for batches of static images where only the last one matters. It's a one-wire drop between your video output and whatever wants a single image, and it keeps the batch dimensions so nothing downstream assumes it got more than it asked for.
How it works
The implementation is five lines of tensor slicing: it takes the input frames and returns frames[-1:, :, :, :], keeping the leading dimension so the output is a valid 1×H×W×C image batch. Nothing fancy, no re-encode, no decode needed - you're already working in the image tensor domain. The cost is effectively zero.
The input and output
- frames (IMAGE) - the only input. Wire in your video frames, image batch, or any tensor-shaped
[B, H, W, C]stack. - image (IMAGE) - the last frame as a single-image batch, ready to feed into anything that accepts an image.
If frames is empty or None, the node raises a clear error rather than silently returning garbage, so you'll know you wired the wrong thing.
Installing it
This is one of the small utility nodes inside COMFYUI_PROMPTMODELS (shown in Manager as PromptModels Studio). Install the pack once:
cd ComfyUI/custom_nodes
git clone https://github.com/cdanielp/COMFYUI_PROMPTMODELS
Restart ComfyUI, and it's under the 🧩 Utility category. No API key, no model downloads, no dependencies beyond what ComfyUI already has - this node doesn't call out to anything.
Common issues
Honestly there's not much to break. The one recurring confusion is people wiring an image list (multiple IMAGE connections) instead of a single batch tensor - if you get a shape error, re-check that the input is one IMAGE stream with many frames, not several separate streams. And if you need an arbitrary frame rather than the last one, the same pack includes GetFrameByIndex, which is this node with an index dial on it. For a "last frame only" job, though, this is the one.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| frames | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |