Nodes/WAS Node Suite v3/Image Batch Ends
ComfyUI Node Runs on cloud

Image Batch Ends

Grab the last frame, drop the duplicate

By WASasquatch·Created 3 years ago·Updated 4 days ago· 1,844
Image Batch Ends
  • images
  • first
  • last
  • first_n
  • last_n
  • without_first
  • without_last
  • batch_size
count1

Long videos out of image-to-video models are built one clip at a time: generate a clip, take its last frame, feed that frame back in as the seed for the next generation, and stitch. That's the "last-frame chaining" trick people use to push Wan and LTX past their native frame counts. The fiddly part is the bookkeeping - you need the closing frame out of one batch and you need to drop the duplicate frame where the two clips meet so the seam isn't a doubled still. Image Batch Ends is all of that bookkeeping in one node.

It's one of the batch-manipulation helpers in WAS Node Suite (WASasquatch's MIT pack, 457 nodes in v3). Where a node like Image Batch Repeat pads a clip to a length, this one peels the edges off a batch and hands you exactly the pieces a continuation workflow wants.

What comes out

Everything is a batch even when it's one frame, which keeps the socket types clean and means you can wire straight into another node that wants an IMAGE. The seven outputs are:

  • first and last - frame 0 on its own, and the closing frame on its own. last is the one you feed to an I2V model to carry on from where the clip stopped.
  • first_n and last_n - the opening and closing N frames, where N is the count input (default 1). Want the last eight frames as context? Set count to 8.
  • without_first and without_last - the whole batch minus frame 0, or minus the final frame. This is the seam fix: a continuation model repeats the frame you seeded it with, so without_first on the returned clip drops that repeat before you join.
  • batch_size - how many frames came in, numbered 0 to batch_size−1. Wire it to anything that needs the clip length told to it.

The count input caps out high enough that it doesn't matter - more than the batch holds just gives you the whole batch. An empty batch is refused.

The workflow this exists for

Say your first clip is 81 frames. You want 162. You take last from the batch, feed it to the I2V sampler as the start frame, and the model hands back an 81-frame continuation whose frame 0 is a copy of that seed. Stitch the two batches and the same frame appears at positions 81 and 82 - a visible hitch. So you join the first clip with the continuation's without_first, and the join is seamless.

From the other side, if your continuation model consumes a context tail, last_n gives you the frames to feed, and without_last is the mirror for trimming the incoming end. The node was clearly written by someone who'd done this dance by hand and was tired of slicing tensors with index nodes.

Batch gotchas

Two things trip people up. First, a batch of one frame: first and last are the same frame, and without_first/without_last have nothing to drop - they just answer that single frame. Nothing breaks, but don't read "without first = 0 frames" and build logic on it. Second, every output is a separate tensor, so if you wire several outputs and only change count, re-run everything downstream - there's no caching trick saving you.

Install is the standard WAS Node Suite one: ComfyUI Manager, search "WAS Node Suite v3", or clone https://github.com/WASasquatch/was-node-suite-comfyui into ComfyUI/custom_nodes and restart (ComfyUI 0.14.0+, Python 3.10+). v3 needs no pip step and downloads nothing - a real relief after v2, whose pinned dependencies were a running source of import failures when ComfyUI updated.

If this node looks like half of what you need, the other half is its sibling Image Batch Split, which cuts a batch at an arbitrary frame. Ends peels the ends; Split cuts anywhere. Between the two, the chaining toolkit is complete.

CategoryWAS Suite/Image

Inputs (2)

NameTypeDefaultDescription
imagesIMAGEThe batch to take the ends off. Frames come back in the order they arrived, and a batch with no frames in it is refused.
countINT11–16384How many frames first_n and last_n give back. 1 = one frame each; 8 = the opening eight and the closing eight. More than the batch holds gives the whole batch. first, last, without_first and without_last ignore it.

Outputs (7)

NameTypeDescription
firstIMAGEFrame 0 on its own, as a batch of one. A batch of one answers that frame here and on last.
lastIMAGEThe closing frame on its own, as a batch of one. Feed it to an image to video model to carry on from where the clip stopped.
first_nIMAGEThe opening count frames, in order. With 10 frames and count = 3 that is frames 0, 1 and 2; a count above 10 gives all 10.
last_nIMAGEThe closing count frames, in order. With 10 frames and count = 3 that is frames 7, 8 and 9; a count above 10 gives all 10.
without_firstIMAGEEvery frame but frame 0, so 10 frames give 9. A continuation repeats the frame it was seeded with, and this drops it before the join. A batch of one has nothing to drop and answers its single frame.
without_lastIMAGEEvery frame but the closing one, so 10 frames give 9. It joins a clip to a continuation from the other side. A batch of one has nothing to drop and answers its single frame.
batch_sizeINTHow many frames arrived, so they are numbered 0 to batch_size - 1. Feed it to a node that needs the length of the clip told to it.