Nodes/Praveen's ComfyUI Tools/Select Last Image
ComfyUI Node

Select Last Image

Keep the last frame — usually the one that matters

By Praveenhalder·Created about a year ago·Updated 6 months ago· 2
Select Last Image
  • images
  • image

Select Last Image pulls the final frame out of a batch and hands it to you as a single image. One input, one output, zero options - and a deceptively useful trick in video workflows, where the last frame is frequently the answer you were actually after.

Think about how video generation ends: you sample a clip, and the frame you'd actually save or edit is often the last one - the endpoint of the motion, the settled pose, the final state of whatever you asked for. This node makes that one-frame extraction a single wire instead of a slicing subgraph.

Inputs and output

  • images (IMAGE, optional) - the batch. It's marked optional in the schema, but treat that as a formality: the node raises a clear error if nothing is connected.
  • Output: image - the last frame, returned as a [1, H, W, C] batch of one, so it plugs straight into anything that expects an IMAGE.

How it works

It's images[-1] with a couple of safety guards: a 3D single-frame input gets a batch dimension added, and an empty batch raises a ValueError rather than silently returning garbage. The error-on-empty is actually a feature - it fails loudly at the point of the mistake instead of poisoning the downstream graph.

Where it fits

The natural companion in this pack is Skip First Image (drop the head, keep everything else); together they trim a sequence from both ends. It also pairs with the pack's batch-splitting and merging nodes if you want to inspect the tail of a specific slice. And it's the sensible thing to wire before a SaveImage when your batch is a generated clip and you only want the final frame on disk.

One thing it won't do: it won't tell you which frame is best, it just gives you the last one. If you need the "best of N candidates," you want a comparison node, not this. This is for when the position is the criterion.

Installation

Part of Praveen's ComfyUI Tools. Install via ComfyUI Manager (search "Praveen" / "praveen-tools"), or:

cd ComfyUI/custom_nodes
git clone https://github.com/Praveenhalder/praveen-tools

Restart ComfyUI. No extra dependencies - PyTorch, PIL, NumPy, all already in ComfyUI - and no model downloads. It's a tiny node with one clear job, and it does it without drama.

Categoryimage/utility

Inputs (1)

NameTypeDefaultDescription
imagesoptIMAGE

Outputs (1)

NameTypeDescription
imageIMAGE