✂️ Image Batch Slice
Python slicing you already know, minus the sharp edges
- images
- IMAGE
If you've ever written images[2:5] in Python, you already know this node. ImageBatchSlice grabs a contiguous run of images out of a batch by start and end index, Python style - start inclusive, end exclusive - and hands you back the ones in the middle. It's the least flashy member of the ComfyUI-ImageBatchUtils family, and it's exactly as useful as you'd expect from "the batch operation people reach for constantly."
What it does
Three inputs:
images- theIMAGEbatch.start(INT, default0) - first image to keep, inclusive.end(INT, default1) - stop before this index, exclusive.
Output is a LIST[IMAGE] - each image individually shaped [1, H, W, C], original sizes intact, no padding. Negative indices work exactly like Python: start = -3 gives you the last three images. Out-of-range values don't crash anything; the node clamps them to the valid range, and a start beyond the end just yields an empty list.
The part that matters: list vs. batch
Here's the difference from ComfyUI core's built-in image-slicing node. Core's Image From Batch takes an index and a length and returns a batch tensor - useful if a downstream node wants a batch. This node returns a list of singles, which is what you want when the next node processes images one at a time. The two aren't interchangeable, so the question isn't "which is better," it's "does the next node want a batch or a list?" This one also flattens list inputs (INPUT_IS_LIST), so it plays nicely after nodes like SEGSPreview that emit lists instead of a clean batch.
When you'd actually use it
- "Just the first N." A workflow generated 8 variations and you only want to keep and upscale the first 4.
start=0, end=4. - "Just the last N." The batch is a sequence of frames and you want the tail. Negative indexing is where this node quietly beats fiddling with a length widget.
- Split in half. First half and second half, two slice nodes sharing the same batch. Pair each with
ImageBatchCountif you want the split to follow the actual batch size rather than a hardcoded number.
Install
Identical to the rest of the pack - zero dependencies beyond ComfyUI, no models, MIT:
cd ComfyUI/custom_nodes
git clone https://github.com/xuxiao305/ComfyUI-ImageBatchUtils
then restart. Or find ComfyUI-ImageBatchUtils in ComfyUI Manager and click install; all six nodes arrive together. There is no requirements.txt to babysit, which for a custom node is close to a luxury.
Gotchas
Remember end is exclusive. start=1, end=2 gives you one image (the second), and setting start=1, end=1 gives you nothing - the same off-by-one that catches everyone in Python gets you here too. And keep in mind the output is a list, so the downstream node has to accept LIST[IMAGE]; if it demands a single batch, you'll get a type mismatch, not a friendly explanation.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| start | INT | 0-9999–9999 | — |
| end | INT | 1-9999–9999 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |