Nodes/ComfyUI-Creepy_nodes/Filter Image Paths (Creepybits)
ComfyUI Node

Filter Image Paths (Creepybits)

The 10-line node that lists every image in a folder

By Creepybits·Created about a year ago·Updated 2 months ago· 32
Filter Image Paths (Creepybits)
    • image_paths
    folder_path

    Filter Image Paths is the simplest node in the Creepybits pack, and it's honest about it. You give it a folder_path, it lists every image file in that folder, and it hands you back the full paths. That's the entire feature. No resizing, no deduplication, no subfolder traversal - it's a ls command wearing a ComfyUI costume.

    So why would you bother putting a directory listing inside a graph? Because a list of image paths is a legitimately useful building block. Feed it into a text-processing node to count assets, use it to verify a folder actually contains what you think before a batch job, or pipe the paths into a prompt and let an LLM decide what's there. It's the kind of node that's invisible until you need it, then you're glad it exists.

    How it works

    One input, one output. folder_path is a plain STRING field - type or paste a directory path, absolute paths only. The node iterates the directory with os.listdir and keeps only files that Python's imghdr module recognizes as real images. Anything that isn't a valid image file (or isn't a file at all) is skipped.

    It's marked as an output node in the schema (OUTPUT_NODE = True), which matters more than it sounds: it means the node also prints its result to the ComfyUI console. If you run it and see nothing obvious in the UI, check the terminal window - the list of paths lands there.

    The output is named image_paths and is typed as a string. The practical behavior: you get the paths back for downstream use, and the node doesn't block on anything - it runs in milliseconds unless the folder is enormous.

    What it doesn't do

    Worth being explicit about the limits, because they'll bite you:

    • No recursion. It scans only the top level of folder_path. Images in subfolders are invisible to it.
    • imghdr is old. It's a deprecated stdlib module that sniffs file headers, and it misses some newer formats and some edge cases. PNG/JPG/GIF/BMP and friends are fine; don't be shocked if an exotic format gets skipped.
    • It's a lister, not a loader. These are file paths, not IMAGE tensors. If you want actual images out of a folder, use the pack's Load Batch From Dir nodes instead - this one is for working with the names.

    Installing it

    Same pack, same drill - this ships in ComfyUI-Creepy_nodes:

    • ComfyUI Manager: search "Creepy_nodes" and install.
    • Manual:
      cd ComfyUI/custom_nodes
      git clone https://github.com/Creepybits/ComfyUI-Creepy_nodes.git
      

    Restart ComfyUI. Zero extra dependencies - it uses only the Python standard library, so there's nothing to pip-install for this node alone.

    Troubleshooting

    The one real failure mode: a bad path. If folder_path isn't a valid directory, the node prints an error to the console and returns an empty list - quietly, no red error in the graph. So if you get an empty output and you're sure the folder has images, first double-check the path is exactly right (Windows backslashes and all), then check the console log to see the actual error message.

    CategoryCreepybits/utilities

    Inputs (1)

    NameTypeDefaultDescription
    folder_pathSTRING

    Outputs (1)

    NameTypeDescription
    image_pathsSTRING