Nodes/comfyui-timesaver/TS Image Batch Cut
ComfyUI Node

TS Image Batch Cut

Trim the junk frames off the front and back

By AlexYez·Created 2 years ago·Updated a day ago· 12
TS Image Batch Cut
  • image
  • image
first_cut0
last_cut0

Every video workflow produces garbage at the edges. The sampler's warm-up frames, the loader's extra handles, the intro and outro frames you don't want in the final render. TS Image Batch Cut is the two-dial answer: first_cut drops N frames from the start of an image batch, last_cut drops N from the end, and you're done.

It's about as simple as a node gets - a batch in, a batch out, two numbers - but it's the kind of plumbing you end up using in every video graph. The node-plumbing doc's whole thesis is that these utility nodes exist to fight repetition and illegibility; this one fights repetition, specifically the "manually figure out which frame index starts the good footage" ritual.

How it works

Slice a tensor. image is your batch [B,H,W,C], first_cut trims the front, last_cut trims the back. Two details matter:

  • Negative values are treated as zero - so if you wire in a computed value that sometimes goes negative (say, a frame count derived from a formula), it just means "no cut" instead of crashing or doing something weird.
  • An over-cut returns an empty batch - cut 50 frames from a 30-frame batch and you get zero frames out, not an error.

That last behavior is worth knowing because it's a deliberate design choice: an empty batch is a legitimate signal (your downstream saver just writes nothing), not a crash. If you're cutting more than you meant, the node won't tell you with an exception - it'll just hand back nothing.

The inputs and output

  • image - the batch (e.g. video frames) to trim.
  • first_cut - frames to drop from the start (default 0, up to 4096).
  • last_cut - frames to drop from the end (default 0, up to 4096).

Output: image - the trimmed batch. Empty if the cuts remove every frame. That's the whole API. Wire it into whatever consumes the batch next (interpolation, preview, saver).

Installing it

Part of comfyui-timesaver (ComfyUI Manager → "Timesaver", or manual clone + pip install -r requirements.txt + restart). No models, no dependencies beyond the pack - pure tensor slicing.

Notes from the field

The most common beginner move is cutting by index instead of count: if you want to keep frames 10 through 20 of a 30-frame batch, that's first_cut=10, last_cut=10, not first_cut=10, last_cut=20. Easy to get wrong the first time, obvious forever after. Also worth knowing: because it's a pure batch operation, it works identically on still-image batches and video frame sequences - a batch is a batch. If you find yourself wanting to split a batch into segments rather than trim the ends, that's a different job; this node only trims edges, and it's at its best when you wire it between a loader/preview chain and the node that actually uses the frames.

CategoryTS/Image/Batch

Inputs (3)

NameTypeDefaultDescription
imageIMAGEImage batch (e.g. video frames) to trim.
first_cutINT00–4096Number of frames to drop from the start of the batch.
last_cutINT00–4096Number of frames to drop from the end of the batch.

Outputs (1)

NameTypeDescription
imageIMAGETrimmed image batch. Empty if the cuts remove every frame.