KV Image Path (Registry Key)
Get a real file path out of your KV registry
- path
KV Image Path (Registry Key) is the pack's path-building helper. It doesn't load anything - it just turns a registry key into a full filesystem path to an image, the kind of string ComfyUI's own Preview Image and Load Image nodes expect. If you keep a JSON registry of prompts and a matching folder of style images, this is the node that connects the two without you hand-typing paths.
The use case that makes sense of it: your registry JSON is millerlight-styles.json with a key like golden, and you've dropped golden.png into custom_kv_stores/images/millerlight-styles/. This node builds that exact path from the key, so when KV Get Value tells you which style is selected, this node tells you where its picture lives.
How it works
Both real inputs - key and registry_path - are declared with forceInput, which is ComfyUI's way of saying "wire me, don't type me." The typical setup feeds registry_path from the path output of KV Load from Registry, so you never hardcode a folder.
The path is constructed in kv_nodes.py as:
<ComfyUI>/custom_kv_stores/images/<registry-file-basename>/<key>.png
Two details worth knowing. First, if your key is golden.png the node strips the extension and uses that instead of the ext input - so a key that already has an extension wins. Second, names are sanitized (anything non-alphanumeric becomes _), so keys like my style become safe filenames.
The catch: this node never checks the file exists. It builds the path and hands it over. A blank image downstream usually means the file isn't where the path points, not that the node failed.
Inputs and output
key(string, forceInput) - the registry key whose image you want.registry_path(string, forceInput) - path to the registry JSON, typically from KV Load from Registry.ext(enum) - currently onlypngis offered.
Output: path (STRING), which you feed into Preview Image or Load Image's file input.
Why not just use the other preview node?
The pack also ships KV Preview Image (Registry Key), which loads the actual image tensor for you. Reach for this path-only version when you'd rather ComfyUI's native nodes do the loading - for example when you want a standard Preview Image on the graph with its normal controls, or you're passing the path to a custom node that expects one.
Install
Same pack, same story: ComfyUI Manager → Install via URL → https://github.com/millerlight/ComfyUI-KVTools, or:
cd /path/to/ComfyUI/custom_nodes
git clone https://github.com/millerlight/ComfyUI-KVTools.git
Restart ComfyUI and hard-reload the browser. No pip dependencies - requirements.txt is empty and the path logic is pure stdlib.
Common issues
- Blank preview - check the file actually sits at the constructed path. There's no existence check, so a typo or a missing image gives you nothing, silently.
- Weird filenames with underscores - that's the sanitizer; name your image files to match the key exactly (letters, numbers, dots, underscores) and you won't fight it.
- Empty path output - if
keyorregistry_pathis empty, the node returns"". Wire both up properly and it goes away.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| key | STRING | — | |
| registry_path | STRING | — | |
| ext | COMBO | png | 1 options: png |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| path | STRING | — |