Nodes/Comfyui_PDuse/PD_Extract Image (Index)
ComfyUI Node

PD_Extract Image (Index)

Pull one frame out of a batch

By 7BEII·Created 2 years ago·Updated 15 days ago· 53
PD_Extract Image (Index)
  • images
  • image
image_index0

PD_Extract Image (Index) (PD_Extract_Image) takes an image batch and hands you back a single frame by index. Feed it a stack of images from a grid splitter or a folder loader, set the index, and out comes just that one image - ready to preview, save, or pass into a single-image node.

Why you'd reach for it

The gap it fills is real. ComfyUI's batch handling is great at iterating over a stack but awkward at picking one member out when a node only accepts a single image. Need to inspect frame 7 of a 12-frame batch, save just the best image from a batch of seeds, or grab the first frame of an output to use as an input elsewhere? That's this node. It sits naturally downstream of the pack's PD_Load Images or ImageGridSplitter, both of which emit batches.

How it works

The author's description calls it a "global index extractor": whatever you feed in - a single batch tensor or a list - is treated as one continuous sequence, and the node pulls out the frame at image_index. The input range of −10000 to 10000 isn't just tolerance: negative indices are a feature, with −1 giving you the last image, which is handy when you don't know the batch length in advance. Out-of-range positive indices error, so keep the index inside what you actually loaded.

Inputs and output

  • images - the batch (IMAGE).
  • image_index - which frame to extract, 0-based. Default 0. Negative counts from the end.

Output is a single image - one frame, ready for anything that wants a lone image.

Installing

Part of the 7BEII/Comfyui_PDuse pack. ComfyUI Manager → search "Comfyui_PDuse" → install, or:

cd ComfyUI/custom_nodes
git clone https://github.com/7BEII/Comfyui_PDuse
cd Comfyui_PDuse
pip install -r requirements.txt

Restart after. No models; pure tensor slicing, no special dependencies beyond the pack's standard install.

Gotchas

Indexing is 0-based - index 0 is the first image, so grabbing "the first one" means leaving it at the default, not entering 1. And remember the negative-index trick only works as a helper when you know your batch is at least that long. The node expects a batch as its images input; if you wire in a list-typed output from one of the pack's list-emitting loaders, make sure it's actually a batch tensor and not a Python list, or you'll get a type mismatch at the port.

CategoryPD_Image/Processing

Inputs (2)

NameTypeDefaultDescription
imagesIMAGE
image_indexINT0-10000–10000

Outputs (1)

NameTypeDescription
imageIMAGE