Nodes/ComfyUI-Apt_Preset/batch_BatchSlice
ComfyUI Node

batch_BatchSlice

Python list slicing for your ComfyUI batches

By cardenluo·Created 2 years ago·Updated 18 days ago· 309
batch_BatchSlice
  • LIST
  • Data
start0
end-1

This one is exactly what it says on the tin: it's my_list[start:end] as a node. If you've ever loaded a folder of 200 images and only wanted frames 10 through 40, or pulled a batch of prompts out of a text file and needed just the back half, this is the tool. No AI, no model, no sampling - it's a data-plumbing node from Apt_Preset's utility section, and it's one of the more genuinely useful ones precisely because it does one small thing correctly.

What it's for

Apt_Preset ships a LIST type it uses for batch operations - sequences of images, text, shots, whatever - built up by its own IO_LoadImgList / IO_LoadImgBatch style loaders (not covered in this article, but the pack's README calls out those loaders explicitly as a 2025-early-2026 addition). Once you've got a LIST, you often don't want the whole thing: maybe you're testing a video-segmentation pipeline and only want a handful of frames before you commit a full run, or you're chaining batches and need to drop the first few duplicate entries. batch_BatchSlice does that trim.

Inputs and outputs

There's nothing subtle here, which is the appeal:

  • LIST - the list you're slicing, coming from whatever upstream node built it.
  • start (default 0) - the index to begin at, Python-style (0 is the first element).
  • end (default -1) - the index to stop before. -1 is Python's "to the end" shorthand, so the default is "give me everything from start onward."

The output is a single Data port, typed * (wildcard) - the sliced sublist, ready to feed into whatever consumes a list downstream: a batch processor, another slice, a merge node like batch_MergeBatch.

If you know Python slicing, you already know this node. If you don't: start=5, end=15 gets you elements 5 through 14 (ten items), and negative numbers count from the end, so start=0, end=-1 is "all but the last one."

Installing it

Via ComfyUI Manager, search ComfyUI-Apt_Preset, install, restart. Or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset.git

then run install.bat on Windows to grab dependencies, restart ComfyUI. This node is pure Python list handling - it needs nothing beyond the base pack install, no models, no extra packages specific to it.

Common issues

Empty output. If start is past the end of your list, or start >= end after Python's slicing rules are applied, you'll get an empty sublist rather than an error. Double-check your list actually has as many items as you think it does before assuming the node is broken - a common culprit is an upstream loader silently returning fewer items than expected (e.g. it skipped a corrupt file in a folder).

The * output type won't connect to something. Because the output is wildcard-typed, ComfyUI will generally let you wire it into most list-consuming inputs, but the receiving node still expects a specific shape internally (a list of images vs. a list of strings, say). If the connection is accepted but the run errors downstream, the mismatch is almost always what your LIST actually contains versus what the next node expected - trace back to the loader that built it.

You wanted to slice an IMAGE batch tensor, not an Apt_Preset LIST. These are different things in this pack - a LIST is the pack's own batch-processing type, not a standard ComfyUI image batch. If your images are already loaded as a normal IMAGE tensor batch, you're looking for a different slicing tool (ComfyUI core has its own batch-index nodes for that); batch_BatchSlice operates on Apt_Preset's LIST type specifically.

CategoryApt_Preset/data/list|Batch

Inputs (3)

NameTypeDefaultDescription
LISTLIST
startINT0
endINT-1

Outputs (1)

NameTypeDescription
Data*