Nodes/ComfyUI-Apt_Preset/IO_load_anyimage
ComfyUI Node

IO_load_anyimage

Load a whole folder of images, or just one by position

By cardenluo·Created 2 years ago·Updated 17 days ago· 309
IO_load_anyimage
    • images
    • file_names
    • file_paths
    • img_index
    • name_index
    • path_index
    • index
    • total
    file_path./input/Apt_in
    remove_extensionfalse
    max_images0
    Include_keyword
    include_subfoldersfalse
    index0

    ComfyUI's built-in image loader wants one file at a time. IO_load_anyimage points at a whole folder instead, and it does two jobs at once: hand you the entire contents as a batch, and let you also pull out one specific image by position - from the same node, in the same run.

    How it works

    file_path is the folder to scan (it defaults to ./input/Apt_in, so either create that folder or point it somewhere real). From there you can narrow things down: Include_keyword filters filenames, include_subfolders decides whether nested folders count too, and max_images caps how many get loaded. The node loads the matching images as a batch and, at the same time, uses index to pick one specific image out of that batch - index starts at 0 for the first image, and negative numbers count from the end (-1 is the last one), per the node's own tooltip.

    Inputs and outputs

    What you'll actually set:

    • file_path - the folder to load from.
    • remove_extension - strips .png/.jpg/etc. from the filename outputs if you turn it on; the tooltip is explicit that this only controls whether the extension shows up in the returned names.
    • index - which single image to also pull out, 0-based, negatives count from the end.
    • max_images, Include_keyword, include_subfolders - narrow the scan.

    Two families of outputs: the batch - images, file_names, file_paths (all lists, one per loaded image) - and the single pick driven by index - img_index (IMAGE), name_index and path_index (STRING), plus index and total so downstream nodes know where you are and how many images there were in total. That combination is handy for anything that both wants "give me everything" and "let me step through them one at a time" - a preview loop, for instance.

    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 (Windows-only - on Linux/macOS run the pip install lines inside it by hand) and restart ComfyUI.

    Common issues & troubleshooting

    max_images sitting at its default of 0 loads everything, not nothing. The 0-1000 range with a default of 0 reads as "no cap" in this node's convention rather than "load zero images" - don't be surprised when it pulls the whole folder despite the field showing zero.

    The default file_path doesn't exist yet. ./input/Apt_in is a folder this node expects, not one ComfyUI creates for you automatically on install - if you get an empty batch on first use, check that the folder exists and actually has images in it, or repoint file_path.

    IMPORT FAILED on startup. This pack has at least one reported case in the wild of failing to import on a stock install, generally traced to skipping the install.bat dependency step (which won't run at all on non-Windows without you opening it and running the commands yourself). Check the console for the specific missing package first.

    CategoryApt_Preset/IO_Port

    Inputs (6)

    NameTypeDefaultDescription
    file_pathSTRING./input/Apt_in
    remove_extensionBOOLEANfalse控制输出的文件名是否包含扩展名
    max_imagesoptINT00–1000
    Include_keywordoptSTRING
    include_subfoldersoptBOOLEANfalse是否包含子文件夹中的图片
    indexoptINT00–1000000从0开始,0对应第一个元素;负数表示倒数,-1为最后一个元素

    Outputs (8)

    NameTypeDescription
    imagesIMAGE
    file_namesSTRING
    file_pathsSTRING
    img_indexIMAGE
    name_indexSTRING
    path_indexSTRING
    indexINT
    totalINT