Nodes/ComfyUI-xiaozhuguang/小珠光从列表获取图像
ComfyUI Node

小珠光从列表获取图像

Grab a slice of any image list — and let ComfyUI loop over the rest for you

By xiaozhuguang·Created 2 months ago·Updated 3 days ago· 66
小珠光从列表获取图像
  • images
  • 图像
index0
length1

Once a ComfyUI workflow hands you multiple images at once, grabbing "just the third one" (or frames 2 through 4) turns into an oddly annoying problem. A batch tensor has no idea what "the third one" means to you. 小珠光从列表获取图像 - XiaozhuguangImageFromList - is the pack's answer: it slices an IMAGE list from a starting index for a given length, and when you ask for more than one image it hands them back as a list so every downstream node runs once per image. You get both a single-image picker and a slice tool in one small node.

It's a pure plumbing node in the best sense - no model, no pixels touched, nothing to download. It exists because the pack's own image loader has a "list" mode that emits multiple images (possibly at different sizes), and once you have that you constantly need to reach into the list rather than consume all of it.

How it works

The two magic flags do most of the work. The images input is declared input_is_list, so the execution engine hands the node the whole list at once instead of fanning each image out to it element-by-element. The output is declared output_is_list, so when the slice contains more than one image, downstream nodes execute once per image - ComfyUI's built-in broadcast behavior. length=1 is just a single pick.

Internally it normalizes whatever you feed it into a list of single-frame tensors: a Python list of images, an already-stacked batch tensor (it unbinds the batch dimension), or one lonely image all end up the same shape. Then it applies your slice and clamps, never errors on a bad index.

The inputs that matter

  • images (IMAGE) - the list, stacked batch, or single image you're pulling from.
  • index (INT, default 0) - where to start. Negative counts from the end, so -1 is the last image. Out of range clamps to the first or last instead of blowing up.
  • length (INT, default 1) - how many consecutive images to take. With a 4-image list, index=1, length=3 gives you images 2, 3, and 4. length=1 is single-take mode.

The output is one 图像 (IMAGE) socket that's really a list. Wire it into any IMAGE input; with a slice longer than one, downstream just runs that many times.

Installing it

This node ships inside the ComfyUI-xiaozhuguang pack (小珠光), a Chinese-community "enhancement" pack with a Bilibili tutorial and an i18n setup. Install the pack, not the node:

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

Then restart ComfyUI (or hit "Update" → reload in ComfyUI Manager). Easier: Manager → "Install Custom Nodes" → search ComfyUI-xiaozhuguang. The pack's requirements.txt pulls in heavy deps - transformers, llama-cpp-python, librosa, bitsandbytes - but those serve the pack's Qwen and TTS nodes. This one only needs torch, numpy, and Pillow, which your ComfyUI already has, and no model files are involved.

Gotchas

The node raises a clear error if the image list is empty - that's by design, not a crash you caused. And remember it wants the full list on the images socket (that's the input_is_list flag). If you're wiring it to a single stacked batch from a normal loader, it still works - it unbinds the batch for you - but if the thing you're slicing comes from another list-emitting node, connect them directly and let this node do the slicing. That pairing with the loader's list mode is exactly the workflow the author built it for.

Categoryxiaozhuguang

Inputs (3)

NameTypeDefaultDescription
imagesIMAGE
indexINT0-999999–999999
lengthINT11–999999

Outputs (1)

NameTypeDescription
图像IMAGE