DataSet_LoadImage
A LoadImage That Also Tells You the File's Name and Path
- image
- image_mask
- image_name
- image_name_without_extension
- image_path
- image_directory_path
ComfyUI's built-in LoadImage gives you an image and a mask and leaves you to guess which file it came from. DataSet_LoadImage does the same job and also hands you the filename, the filename without the extension, the full path, and the directory - which is the whole trick. This is the node you want at the front of a captioning pipeline, because captioning a dataset requires pairing each image with its name so you can write photo_001.txt next to photo_001.png.
It's not a replacement for the stock LoadImage in generation workflows - it's a data-prep front end. The README even positions it that way: it exists to feed images (and their filenames) into the pack's captioning nodes.
How it works
The implementation is essentially ComfyUI's own LoadImage code, lightly forked and with the filename plumbing exposed. It reads from ComfyUI's input directory (where the built-in loader looks), converts the file to an IMAGE tensor, builds a MASK from the alpha channel if the image has one, and returns the file metadata as extra STRING outputs. Nothing exotic - which is exactly what you want from a loader.
Inputs and outputs
The single input, image, is a dropdown of files in your input folder, with the usual upload button.
The six outputs are where it earns its keep:
- image - the IMAGE tensor.
- image_mask - the alpha-channel mask (black-on-white convention, like stock ComfyUI).
- image_name - e.g.
photo_001.png. - image_name_without_extension -
photo_001. - image_path - full path including the file.
- image_directory_path - the folder it lives in.
The captioning workflow
This is the setup that makes sense of all those outputs:
DataSet_LoadImage → DataSet_OpenAIChatImage (or Claude/Groq vision) → caption STRING → DataSet_TextFilesSave.
Wire image_name_without_extension into the save node's name input and the caption into its contents input, and every image gets a correctly-named caption file written next to it. That pairing is the exact thing that's painful to do by hand over hundreds of files, and it's the reason this node exists.
Installing
It's part of the ComfyUI-DataSet pack:
cd ComfyUI/custom_nodes
git clone https://github.com/daxcay/ComfyUI-DataSet.git
cd ComfyUI-DataSet && pip install -r requirements.txt
Restart ComfyUI and it appears under 🔶DATASET🔶. No extra model downloads - the heavy requirements in that file (matplotlib, pandas, and friends) are for the pack's Visualizer node, not this one.
One small thing to know: like the stock loader, it reads from the input directory only, so drop your dataset images there (or in a subfolder) before you look for them in the dropdown. The path outputs are computed relative to that. Beyond that, there's not much to trip on - it's a loader, it loads.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| image | COMBO | 1 options: example.png |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| image_mask | MASK | — |
| image_name | STRING | — |
| image_name_without_extension | STRING | — |
| image_path | STRING | — |
| image_directory_path | STRING | — |