Nodes/Kinburg-Nodes/List Remove
ComfyUI Node

List Remove

Pull Items Out of a ComfyUI List and Get Them Back, Too

By Kinburg·Created 3 months ago·Updated 6 days ago· 1
List Remove
  • list
  • list
  • removed
  • count
index0
count1

The flip side of the pack's List Insert: where that one slides items in, List Remove slides them out - and unlike most "remove" nodes, it hands you what it removed. That matters more than it sounds. If you're chopping frames or prompts out of a collected list and then want to do something with the discarded ones (preview them, save them, feed them somewhere else), having removed as an output is the difference between a workflow and a dead end.

What it takes

  • list (optional) - the list to remove from. Works on a ComfyUI list of any type.
  • index - where to start removing, 0-based. Negative counts from the end, so -1 starts at the last item.
  • count - how many items to remove, starting at index.

Outputs: list (the remainder), removed (the items you took out), and count (the new length). Because it's a generic list node, the removed items come back as a list too - a multi-item removal gives you a multi-item list on removed, ready to iterate.

When you'd use it

The natural companion to List Insert and the pack's For Each / List Output collection machinery. A few shapes that come up constantly:

  • Trim a collected batch. You ran a sweep, collected N prompts or images, and want to drop the first two or the last one before the comparison grid. List Remove at index with the right count does it without touching the collection loop.
  • Split a list in two. Remove count items, wire the remainder down one path and removed down another. Two lists out of one, positionally.
  • Filter the tail. Negative indices make "drop the last 3 of a batch of unknown length" a one-node operation - no need to know the length.

One rule from the pack to keep in mind: for same-size IMAGE batches, use Image Batch Remove instead - it works frame-wise on the [B,H,W,C] tensor and returns both the batch remainder and the removed frames. The generic ListRemove is for mixed-type lists where items aren't uniform images.

Install

Part of the Kinburg-Nodes pack - ComfyUI Manager (search "Kinburg-Nodes"), or cd ComfyUI/custom_nodes && git clone https://github.com/Kinburg/Kinburg-Nodes, restart. No dependencies. It's a small utility, but "remove with a receipt" is genuinely rarer than it should be in this ecosystem - most remove operations just drop data into the void. This one gives it back to you.

CategoryKinburg-Nodes/flow/list

Inputs (3)

NameTypeDefaultDescription
indexINT0-100000–1000000-based item to start removing at. Negative counts from the end (-1 = last item).
countINT10–100000How many items to remove, starting at 'index'.
listopt*The list to remove item(s) from.

Outputs (3)

NameTypeDescription
list*
removed*
countINT