Nodes/LF Nodes/Load images from disk
ComfyUI Node

Load images from disk

Dump a folder of images into your workflow and actually find the one you want

By lucafoscili·Created 2 years ago·Updated 2 years ago· 50
Load images from disk
  • ui_widget
  • image
  • image_list
  • name
  • creation_date
  • nr
  • selected_image
  • selected_index
  • selected_name
dir
subdirfalse
strip_exttrue
load_cap0
dummy_outputfalse

The stock ComfyUI LoadImage opens one file at a time. That's fine for a single reference shot, but the moment you're grading a batch of renders, captioning a dataset, or A/B-testing the same prompt across twenty seeds, you don't want to hand-pick files. This node from LF Nodes does the obvious thing instead: point it at a directory, and it loads everything in it as one batch.

The fun part is what you get back besides the pixels. Alongside a batched image tensor, it hands you a list of filenames (name), the creation_date of each file, and a count in nr. That metadata is gold when you're pairing images with captions or log lines later - no filename guessing in a downstream text node.

How it works

You give it a dir path and it scans. The inputs that actually matter for a beginner:

  • dir - the folder to read from. Use a plain path like C:/render-output or /home/you/datasets/batch1. If you leave it empty, it scans ComfyUI's default input directory, which is a handy default when you're just testing.
  • subdir - set it to true and it recurses into nested folders. Handy for organized libraries, annoying if you meant a flat folder and now have duplicates.
  • strip_ext - strips .png/.jpg off the names it outputs. Leave it on unless you're matching against something that keeps extensions.
  • load_cap - hard limit on how many images to load. 0 means unlimited. If your dataset has thousands of files, set this before your first queue, not after the beach ball.

The gallery widget (a KUL_MASONRY masonry layout, one of the LF Nodes frontend widgets) shows thumbnails in the node itself, and there's a set of selected_* outputs - selected_image, selected_index, selected_name - so you can load the whole batch and grab the one you're currently eyeballing to send somewhere special, like a detail pass.

Wiring it up

The main image output is a single batch tensor, so it plugs straight into anything that eats an IMAGE - an img2img KSampler, an upscaler, a face detailer. The image_list output is the same data as a list, for the LF Nodes filter nodes (blur, brightness, contrast) that like lists. name is a list of strings in the same order as the images, so zip them together in a text node if you need per-image output filenames.

Installing it

This comes from the LF Nodes pack, which is getting long in the tooth but still works:

cd ComfyUI/custom_nodes
git clone https://github.com/lucafoscili/comfyui-lf

or just open ComfyUI Manager, search LF Nodes, install, and restart. No extra Python dependencies and no model downloads - the frontend is shipped precompiled. One heads-up: this repo was frozen in early 2025 when the author moved active development to the new lf-nodes repo, so don't expect updates. The nodes themselves remain fully functional.

Where people get burned

  • Empty folder → empty output. The dummy_output flag exists precisely for that: flip it on when your downstream nodes can't handle a zero-length batch.
  • Path typos fail silently-ish - you get a node error, not a helpful dialog, so double-check the dir string.
  • get_civitai_info on the sibling selector nodes can throw CivitAI API wobble, but this node never touches the network, so it's a non-issue here.

If you process batches of images a lot, this is the node that makes ComfyUI feel like a real image pipeline instead of a single-file viewer.

Category✨ LF Nodes/IO Operations

Inputs (6)

NameTypeDefaultDescription
dirSTRINGPath to the directory containing the images to load.
subdirBOOLEANfalseIndicates whether to also load images from subdirectories.
strip_extBOOLEANtrueWhether to remove file extensions from filenames.
load_capINT0Maximum number of images to load before stopping. Set 0 for an unlimited amount.
dummy_outputBOOLEANfalseFlag indicating whether to output a dummy image tensor and string when the list is empty.
ui_widgetoptKUL_MASONRY[object Object]

Outputs (8)

NameTypeDescription
imageIMAGE
image_listIMAGE
nameSTRING
creation_dateSTRING
nrINT
selected_imageIMAGE
selected_indexINT
selected_nameSTRING