Nodes/RobeNodes/List Image Path 🐀
ComfyUI Node

List Image Path 🐀

Walk a folder of images with an index dial

By RobeSantoroΒ·Created 2 years agoΒ·Updated 3 months agoΒ· 0
List Image Path 🐀
    • image_paths_list
    • selected_image_path
    • count
    • width
    • height
    • image
    β—„directoryW:\ATTRAVERSO\OPERE\scrape\images_renamed\Selectionβ–Ί
    β—„index0β–Ί
    β—„cycleenableβ–Ί

    Point this at a folder of images and you've got a batch img2img rig. The node lists every .jpg, .jpeg, .png, and .gif in the directory, you pick one by index - with cyclic wrapping so the last index loops back to the first - and it hands you everything downstream needs: the selected path, the count, the dimensions, and the actual image as a tensor. It's the "walk through my reference folder" node, and for any workflow that processes a folder one image at a time it removes the manual Load Image dance entirely.

    How it works

    Under the hood it's deliberately simple: os.listdir, filter by extension, then select by index. cycle is the one setting that changes behavior - enable wraps the index around with modulo (index 999 on a 10-image folder gives you image 0), disable clamps to the last valid index. The selected file is loaded with PIL, EXIF orientation is applied automatically (exif_transpose), and it's converted to RGB before becoming the IMAGE tensor - so your phone photos and camera files come in upright and consistent, which is a real convenience the stock loader doesn't always give you. If the image can't be loaded, you get a harmless 64x64 zero tensor instead of a crash.

    The outputs are worth listing because there are six and they're all useful:

    • image_paths_list (LIST) - the full list of filenames
    • selected_image_path (STRING) - full path of the current pick
    • count (INT), width (INT), height (INT)
    • image (IMAGE) - the loaded tensor, ready for a VAE encode, img2img, or a ControlNet preprocessor

    Where it fits

    Wire image into an img2img sampler or an encoder, bump the index between runs, and you've got a poor-man's batch processor. It pairs naturally with the pack's Get File Name for save naming, and with Indices Generator if you're pulling specific frames from a sequence. The pack also ships a canvas-menu utility ("normalize path") that rewrites Windows/Unix path styles in a workflow - handy since the defaults here are author's-machine paths.

    Installing the pack

    Search "Robe Nodes" in ComfyUI Manager, or:

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

    Restart ComfyUI. This node needs PIL (core) plus the pack's opencv-python for other members; Manager handles dependencies.

    Where people get burned

    The default directory is a Windows path from the author's own rig (W:\...) - it will not exist on your machine, and the node silently returns an empty list and a None image if the folder is missing. Change it before running. Also note the listing is not recursive (unlike the pack's model-list node), and GIFs load their first frame. If you're looping a batch, leave cycle on enable and just increment the index.

    One small honesty note: this is a personal utility pack, near-zero community footprint, so you're on your own for feature requests - but for a folder-walking image selector, it does the job cleanly.

    CategoryRobeNodes

    Inputs (3)

    NameTypeDefaultDescription
    directorySTRINGW:\ATTRAVERSO\OPERE\scrape\images_renamed\Selectionβ€”
    indexINT0β€”
    cycleCOMBOenable2 options: enable, disable

    Outputs (6)

    NameTypeDescription
    image_paths_listLISTβ€”
    selected_image_pathSTRINGβ€”
    countINTβ€”
    widthINTβ€”
    heightINTβ€”
    imageIMAGEβ€”