❌ 删除首/末帧图片
Peel the first or last frame off a batch — the 'deck of cards' node
- image_batch
- image_batch
The mirror image of GetFirstImageFromBatch: where that node extracts a frame, this one removes it. "❌ 删除首/末帧图片" takes an IMAGE batch, drops the first or last frame, and returns the rest. It sounds like a nothing-node until you want to trim a duplicated frame, drop the fade-in/out of a generated video, or - in the batch-assembly pattern this pack loves - progressively consume a stack one frame at a time.
How it works
A slice, nothing more. In first mode it returns image_batch[1:]; in last mode, image_batch[:-1]. Two edge cases get handled deliberately: if the batch is already empty, it passes through unchanged, and if you feed it a single 3D image, it returns a zero-size batch rather than crashing. The latter is worth knowing - remove the only frame and you get empty, not an error, which can quietly surprise a downstream node that assumed it'd get something.
Inputs and output
image_batch(IMAGE) - the stack to trim.mode-firstorlast, defaultfirst.- Output:
image_batch(IMAGE) - the batch minus one frame, batch dimension preserved.
The pairing that makes it useful
On its own it trims frames. In combination it becomes a loop primitive: GetFirstImageFromBatch to grab the current first frame, this node to drop it, append the result back with AppendImagesToBatch - and you've got a "deal one card at a time" structure you can drive around a loop or a reroute. That's the pattern these batch utilities in the pack are clearly designed to support, even if the README never says so.
Real-world trims it's also good for: your video generator always emits the same title card on frame one and you want it gone; you're building a "last frame" workflow and need to drop the final frame to make room for a different ending.
Installing it
Standard pack install - ComfyUI Manager → search comfyUI_LLM, or:
cd ComfyUI/custom_nodes
git clone https://github.com/XieJunchen/comfyUI_LLM
# restart ComfyUI
Pure torch slicing, no extra dependencies.
Where people get burned
- Single-frame input → empty output, silently. No error, just a
(0,...)tensor that many nodes can't handle. If your downstream suddenly produces nothing, check whether the batch shrank to zero. - It does not check for empty input. A zero-length batch in gives a zero-length batch out - no crash, but also no work done. Harmless, but easy to misread as a bug.
- No resolution checking, no
modebeyond first/last. Nothing to tune, which keeps it honest.
It's a one-trick node with one good trick. If you're assembling or trimming frame batches in this pack's ecosystem, it earns its slot next to the other batch utilities.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image_batch | IMAGE | — | |
| mode | COMBO | first | 2 options: first, last |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image_batch | IMAGE | — |