ComfyUI Node

From List

Grab a slice of any list

By silveroxides·Created 2 months ago·Updated about 7 hours ago· 24
From List
  • items
  • items
start_index0
number_of_entries1

If you've ever loaded a video's frames as a list and wished you could just keep frames 40 through 60, this is your node. UC_FromList returns a consecutive range from any ComfyUI list - images, latents, strings, conditioning, whatever - and it doesn't care what's inside because it's polymorphic. The socket type adopts whatever list you plug into it.

This is plumbing in the best sense: it lives in the layer that ComfyUI hides behind its flashier samplers. Its two real jobs are (a) shrinking a big list to the subset you actually want to process, and (b) grabbing one element out of a batch list so a downstream node that expects a single input can run on it.

How it works

The mechanism is exactly what the name promises - a slice. It keeps the input list in its existing order, starts at start_index, and returns up to number_of_entries consecutive items. One important behavior: it stops at the end of the list rather than erroring, so asking for 10 entries from a 6-item list quietly gives you 6. That's friendlier than it sounds - it makes the node safe to wire into workflows where the list length changes between runs.

The inputs that matter

  • items - the list. Connect any list-typed socket (a video-frame sampler's image list, a batch of prompts, a list of latents).
  • start_index - zero-based position of the first item you want. Default 0.
  • number_of_entries - how many consecutive items to return. Default 1, so by default it's a "first item of the list" node.

Output is a single items socket of the same type as the input, carrying your slice.

Installing it

ComfyUI Manager → search "ComfyUI-UtilsCollection" → install, or:

cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-UtilsCollection

Restart after. This pack's requirements are minimal - opencv-python and typing-extensions, no model files, no API keys. It's built on the newer ComfyExtension API, so a reasonably up-to-date ComfyUI is assumed.

Two gotchas worth knowing. First, lists and batches are different animals in ComfyUI: a node that outputs an image list hands you separate items, and many classic nodes want an image batch. If a downstream node complains about types, the fix is usually a List to Image Batch style converter, not this node - it stays in list land. Second, start_index is zero-based. Newcomers habitually type 1 to skip the first image and get exactly that image back instead of skipping it. The default of 0 is correct for "give me the first one."

Categoryutils/list

Inputs (3)

NameTypeDefaultDescription
itemsCOMFY_MATCHTYPE_V3Input list retained in its existing order.
start_indexINT0Zero-based index of the first item returned.
number_of_entriesINT1Maximum consecutive items returned from the start index; stops at the end of the list.

Outputs (1)

NameTypeDescription
itemsCOMFY_MATCHTYPE_V3