Nodes/ComfyUI-Apt_Preset/IO_image_select
ComfyUI Node

IO_image_select

Pick specific frames out of a batch by index

By cardenluo·Created 2 years ago·Updated 18 days ago· 309
IO_image_select
  • images
  • select_img
  • exclude_img
indexes1,2
canvas_operationsNone

You generated a batch of eight and only three are keepers. IO_image_select is the node that pulls exactly those three out - and hands you the other five back on a second wire, in case you want to do something with the rejects too.

How it works

Feed it a batch of images and a string in the indexes field describing which ones you want. The syntax is deliberately spreadsheet-simple: 1,3,5 picks specific frames, -1,-3 counts from the end (-1 is the last image), and 2-4 is an inclusive range. Indexing here starts at 1 for the first image - the one exception is 0, which is a special case meaning "don't touch anything, just pass the whole input straight through." That's a genuinely easy mistake to make if you're used to 0-based thinking, so don't type 0 expecting "the first frame."

There's also a canvas_operations dropdown that applies a transform to what comes out - flip horizontal, flip vertical, rotate 90/180, or a couple of combined flip+rotate presets - handy if half your batch came out mirrored or sideways and you'd rather fix it here than add a separate transform node.

Inputs and outputs

  • images (IMAGE) - the batch to filter.
  • indexes (default "1,2") - which frames to keep, using the syntax above.
  • canvas_operations - optional flip/rotate applied to the output.

Two outputs: select_img, the frames matching your index string, and exclude_img, everything that didn't match. Wire select_img to whatever uses the keepers, and exclude_img to a save node, a discard pile, or nothing at all if you don't need it.

How to install it

ComfyUI Manager → search ComfyUI-Apt_Preset, install, restart. Manually:

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

then run install.bat for dependencies - it's a Windows batch file, so on Linux/macOS open it and run the pip install commands inside by hand - and restart ComfyUI.

Common issues & troubleshooting

Typing 0 and getting the whole batch back. As above: 0 isn't "the first image," it's "pass everything through unchanged." If your select_img output looks identical to images, check whether indexes accidentally got left at or reset to 0.

Off-by-one confusion. Because indexing starts at 1 (not 0) for actual selections, but 0 is reserved for the passthrough case, it's worth double-checking your index string against the batch you're actually looking at rather than assuming standard programming conventions apply.

IMPORT FAILED at startup. This pack has at least one reported import failure in the wild on a stock install - almost always traceable to skipping the dependency step in install.bat. Check the console for the specific missing package before reinstalling.

CategoryApt_Preset/IO_Port

Inputs (3)

NameTypeDefaultDescription
imagesIMAGE
indexesSTRING1,2
canvas_operationsCOMBONone7 options: None, Horizontal Flip, Vertical Flip, 90 Degree Rotation, 180 Degree Rotation, Horizontal Flip + 90 Degree Rotation, +1

Outputs (2)

NameTypeDescription
select_imgIMAGE
exclude_imgIMAGE