Nodes/IAMCCS-nodes/Wan Image Batch Frame Select
ComfyUI Node

Wan Image Batch Frame Select

Grab one frame out of a video batch without the index math

By IAMCCS·Created 11 months ago·Updated 8 days ago· 113
Wan Image Batch Frame Select
  • images
  • image
  • selected_index
  • batch_count
  • report
modelast
frame_index0

Sometimes you just need a single frame out of an image batch - the last frame of a generated clip to chain into the next segment, the first frame to anchor an I2V, or one frame from the middle to check how the motion's holding up. IAMCCS_WanImageBatchFrameSelect ("Wan Image Batch Frame Select") is the no-math way to get it.

It takes an IMAGE batch, picks one frame according to a mode, and returns that single image plus the index it chose and the total batch size. That last part is the quiet hero: batch_count and selected_index as outputs mean you can wire them into logic downstream without a separate batch-size node.

The four modes

  • last (default) - the final frame. This is the one you want for carrying prev_samples forward or grabbing the end of a shot.
  • first - the opening frame. Your I2V anchor.
  • index - the frame at frame_index (clamped to the batch if you overshoot).
  • from_end_index - the frame frame_index slots back from the end. Handy when you want "the 3rd-to-last frame" without computing the count yourself.

For everything else there's report, a plain string telling you which mode ran and what index it landed on.

When you'd actually use it

This is a plumbing node, and it shines in the exact spot you'd guess: at the tail of a video chain. Decode a chunk, select its last frame, and feed that frame into the next chunk's conditioning or end-frame encoder. In IAMCCS's long-video loops you'll often see it right after a VAE decode, replacing the "take last image of batch" pattern that otherwise needs a small custom script or a Crop-style hack.

It's also genuinely useful for debugging - grab first or index from a decoded batch and route it to a preview node to inspect a specific frame without dumping the whole clip.

Install

Part of IAMCCS-nodes:

cd ComfyUI/custom_nodes
git clone https://github.com/IAMCCS/IAMCCS-nodes.git

or install via ComfyUI Manager by searching "IAMCCS", then restart. No models, no dependencies, nothing heavy - the pack's compatibility floor (ComfyUI ≥ 0.3.0, Python ≥ 3.12, Torch ≥ 2.8) is all you need to care about.

One caveat

It raises an error on an empty batch, which is correct but worth knowing: if the node upstream produced zero frames, this is where your workflow fails loudly instead of silently. That's a feature. And remember frame_index is 0-based in index mode - the third frame is 2, not 3, which is the one off-by-one everyone hits on day one.

CategoryIAMCCS/Wan

Inputs (3)

NameTypeDefaultDescription
imagesIMAGE
modeCOMBOlast4 options: last, first, index, from_end_index
frame_indexINT00–100000

Outputs (4)

NameTypeDescription
imageIMAGE
selected_indexINT
batch_countINT
reportSTRING