Load Images and Prompts from Directory
Batch-generate from a folder of numbered prompts and reference images
- STRING
- STRING
- IMAGE
Say you've got twenty shots planned out. For each one you've already written the prompt, worked out the negative, and grabbed a reference image to feed a ControlNet or an img2img pass. You don't want to paste all that into text boxes twenty times. That's the whole reason this node exists.
Load Images and Prompts from Directory reads a folder full of numbered files and, given an index, hands you back one matched set: the positive prompt, the negative prompt, and the reference image that all share that number. Bump the index, get the next set. It's a batch loader for people who plan their generations in advance instead of rolling the dice on one prompt over and over.
The idea: pair the prompt with a picture
Batch-prompting from a file isn't new - the Inspire Pack and WAS both have "load a prompt per line" nodes, and people lean on them hard. What's different here is that each entry isn't just text. It's a set: a prompt, a negative, and an image, keyed together by a shared number. The author (a Japanese educator who wrote this for "planned image generation") makes the case plainly in the readme - a reference image alongside the prompt lets you say things a prompt alone struggles to, so you spend fewer rerolls fighting for a composition you already had in your head. That reference is meant to flow straight into ControlNet or i2i, which is exactly where the community says spatial control belongs.
The folder layout you have to follow
This is the part that trips people up, so get it right up front. Everything lives in one directory, and files are matched by their number:
001.txt- the positive prompt001_n.txt- the negative prompt (note the_nsuffix)001.png- the reference image
Then 002.txt / 002_n.txt / 002.png, and so on. The number is the link between the three files. If your image is 003.png but your prompt is 3.txt, they won't pair up - keep the zero-padding consistent.
Inputs and outputs
Only two inputs, and you'll set both:
- dir - the path to that folder. The default text literally says
Please input Directory Path, which is your cue that nothing works until you replace it with a real absolute path. - files_index - which numbered set to load (0 up to 4096). This is the knob you turn to walk through the batch.
The node has three outputs, in order: the positive prompt (STRING), the negative prompt (STRING), and the image (IMAGE). Wire the two strings into your CLIP Text Encode nodes - positive to positive, negative to negative - and send the image into whatever's consuming a reference: a ControlNet preprocessor, a VAE Encode for img2img, an IPAdapter, wherever your plan calls for it.
Installing it
There's no ComfyUI Manager entry to rely on for a pack this niche, so the git route is the sure thing. From your ComfyUI root:
cd ComfyUI/custom_nodes
git clone https://github.com/educator-art/ComfyUI-Load-DirectoryFiles
Restart ComfyUI and it'll show up. Good news: this is pure file I/O - no models to download, no chunky Python dependencies to resolve, none of the dependency-hell roulette that makes adding nodes miserable. It reads text and PNGs off disk and that's it. It's GPL-3.0, for what that's worth to you.
Where people get stuck
The failure modes here are almost all path-and-naming, not code:
- The default path is a placeholder.
Please input Directory Pathis not a folder. Pointdirat a real location - an absolute path is the least ambiguous, since ComfyUI's working directory isn't always where you think it is. - Naming has to be exact. Negative prompts need the
_nsuffix; positives, negatives, and images need the same number. A mismatched or missing file for the index you asked for is where a run falls over. - It doesn't loop by itself. In the graph,
files_indexis a single number - you get one set per run. To actually churn through all twenty shots hands-free you drive it from outside, incrementing the index. The author did exactly this via ComfyUI's API (thebasic_api_example.pyscript) to auto-generate a whole planned batch; that automation lives outside the node and outside the graph.
If your plan doesn't involve a per-entry reference image and you just want a list of prompts, honestly the Inspire Pack's file-based prompt nodes are the more common tool. But if pairing each prompt with its own image and negative is the point - a storyboard, a shot list, a consistent series - this is a tidy little node that does precisely that and nothing else.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| dir | STRING | Please input Directory Path | — |
| files_index | INT | 00–4096 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |
| STRING | STRING | — |
| IMAGE | IMAGE | — |