Nodes/ComfyUI-QHNodes/🐟Image Count From Folder
ComfyUI Node

🐟Image Count From Folder

Count how many images are sitting in a folder

By liuqianhonga·Created 2 years ago·Updated about a year ago· 5
🐟Image Count From Folder
    • INT
    folder

    This one does exactly what it says and nothing else: point it at a folder, get back how many images are in it. It's the kind of node you don't think about until you need it for a batch job - say, driving a loop counter, sanity-checking that a dataset folder actually has the number of images you expect, or setting the load_cap on a paired loader node without opening a file browser to count by hand.

    How it works

    It reads the folder you give it and counts files matching common image extensions (jpg, png, jpeg, and similar). No recursion into subfolders mentioned in the README, no filtering options - it's a one-input, one-output utility node built to be small.

    The inputs and outputs that matter

    • folder (STRING) - the path to count images in. Both absolute paths and paths relative to ComfyUI's root directory work.

    The single output is an INT - just the count.

    How to install it

    Search ComfyUI-QHNodes in ComfyUI Manager, or clone it directly:

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

    Restart ComfyUI. This ships in the pack's main repo, so you don't need the --recursive clone for this one - no submodules involved, and nothing to download since it's purely a filesystem read.

    Common issues & troubleshooting

    Getting 0 when you know the folder isn't empty. Per the README, a folder that doesn't exist (or a typo'd path) returns 0 rather than throwing an error - there's no loud failure here, so if you're seeing zero, the first thing to check is the path itself, not the images inside it. Remember relative paths resolve against ComfyUI's root, not the folder the node itself lives in, so myimages means ComfyUI/myimages, not ComfyUI/custom_nodes/ComfyUI-QHNodes/myimages.

    Count doesn't match what you expected. If your folder has a mix of file types - reference images, mask PNGs, thumbnail caches, whatever - this node counts anything matching an image extension, so a stray thumbnail folder or a .DS_Store-adjacent preview cache can inflate the number past what you'd count by eye. Worth a quick look inside the folder if the count feels off.

    This node pairs naturally with LoadImageFromFolder from the same pack - since that node's load_cap field maxes out at 100 and doesn't have a "load everything" setting, you can wire this node's count into it (right-click the load_cap widget and convert it to an input) to make sure you're pulling the whole folder instead of guessing a number.

    Category🐟QHNodes

    Inputs (1)

    NameTypeDefaultDescription
    folderSTRING

    Outputs (1)

    NameTypeDescription
    INTINT