凤希AI - 获取图片路径
Turn a folder of images into a comma-separated list of paths, no Python required
- 图片路径字符串(逗号分隔)
- 选中图片数量
Most ComfyUI image nodes hand you a tensor - the pixels, ready for a sampler. Sometimes you don't want pixels. You want the actual file paths on disk, because a downstream node, a script, or an API call needs to know where the file lives. That's the entire job of FxAiGetImagePath: given a folder and a selection rule, it returns the paths of the chosen images as one comma-separated string, plus a count.
It's plumbing, and the pack treats it as such - it lives in the 凤希AI/工具 category alongside the number and conversion nodes. If you're building one of this pack's batch pipelines where assets get loaded, listed, and passed around as strings (the image manager nodes output paths like this), this is the lightweight way to derive that string yourself from any folder.
How it works
You give it 图片文件夹路径 and 图片索引, and it does three things: list the image files in the folder (sorted by filename), resolve your index string against that list, and join the winners with commas.
The index string is where the flexibility is, and it's worth reading carefully because it's the same syntax the pack's batch-load nodes use:
0- a single index.0,2,5- several specific indices.0:3- a range (indices 0 through 3 inclusive).-1- all images in the folder.
Any selection is deduplicated and wrapped modulo the total count, so index 99 on a 10-image folder quietly becomes 9. If the folder has no images at all you get an empty string and a count of zero - no crash.
Inputs and outputs
Just the two inputs above, and the two outputs:
- 图片路径字符串(逗号分隔) - the joined paths, comma-separated (not newline-separated; keep that in mind if you're feeding a node that expects newlines).
- 选中图片数量 - how many paths made the cut.
Installing it
This is one small node in the fxai-toolkit pack (凤希AI, MIT). Install via ComfyUI Manager (search "fxai-toolkit") or:
cd ComfyUI/custom_nodes
git clone https://github.com/fxai666/fxai-toolkit
# restart ComfyUI
No models, no extra downloads. The pack auto-installs soundfile and psutil on first load. Docs and support are Chinese (QQ group 775649071, Bilibili).
Where people get burned
Two hard failures and one surprise. First: if the folder path doesn't exist, the node raises a RuntimeError and the run stops - unlike some of the pack's image nodes, this one doesn't tolerate a bad path. Second: a malformed index (a non-numeric token that isn't a range) also raises. And the surprise is the comma separator - copy the output into a node that expects one-path-per-line and only the first path "works," which looks like the node broke when it didn't. Feed the output where comma-separated paths are expected, or split it yourself.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| 图片文件夹路径 | STRING | — | |
| 图片索引 | STRING | 0 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| 图片路径字符串(逗号分隔) | STRING | — |
| 选中图片数量 | INT | — |