Batch Slice
Cut a list down to the frames you actually want
- LIST
- Data
You loaded 24 frames, you want 6 of them, and you don't want to re-run the loader. BatchSlice is a start/end slicer that cuts any list-shaped data down to the range you specify - the same mental model as Python's list[start:end], exposed as a node. It's one of those unglamorous utilities that saves you from building a detour every time a workflow wants fewer items than you have.
It comes from the ComfyUI_Swwan pack, sitting in the same Apt_Preset/data/😺backup category as its sibling list_Slice. The two are near-twins; BatchSlice declares a LIST-typed input and a Data output, while list_Slice takes an Any input and always outputs a list. If you're working with the pack's list nodes, treat them as interchangeable depending on what type your upstream speaks.
How it works
Three inputs: LIST (the data to slice), start (default 0), and end (default -1, meaning "to the end"). The slice is inclusive-start, exclusive-end - so start=2, end=5 gives you items 2, 3 and 4.
It handles negative indices like Python: start=-4 means "four from the end," which is handy for grabbing the last few frames of a batch without counting. Everything gets clamped to the list bounds, and if start ends up past end, you get an empty result rather than an error.
The tensor nicety: if the sliced items are tensors of matching shape (say, single frames), it stacks them back into a single batched tensor instead of leaving you a ragged list. That's the difference between a node you can wire straight into a sampler and one that needs another conversion hop. If shapes mismatch, it falls back to returning the plain list.
Installing it
It ships in ComfyUI_Swwan:
cd ComfyUI/custom_nodes
git clone https://github.com/aining2022/ComfyUI_Swwan
pip install -r ComfyUI_Swwan/requirements.txt
Or install the pack via ComfyUI Manager, search "ComfyUI_Swwan".
Where people get burned
The off-by-one gets everyone once: end is exclusive, so to keep frames 0 through 5 inclusive you want end=6, not end=5. And remember the input needs to be a list - if you're feeding it a batched tensor directly (like raw IMAGE output from a decode), you'll want to convert it to a list first with the pack's Image Batch to Image List. Feeding the wrong shape here yields an empty or mis-sliced result with no clear error, which is the most confusing way for it to fail.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| LIST | LIST | — | |
| start | INT | 0 | — |
| end | INT | -1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Data | * | — |