KV Preview Image (Registry Key)
Preview the image behind a key without hunting through folders
- image
- path
KV Preview Image (Registry Key) is the sibling of KV Image Path (Registry Key) that actually does the work. Same inputs, but instead of handing you a path string it loads the image into a real IMAGE tensor - so it shows up in the graph as a thumbnail and can feed directly into image-conditioned workflows. If your KV registry doubles as a small image library, this is the node that makes the pictures visible.
The setup it's built for: a registry JSON like millerlight-styles.json, with style images sitting in custom_kv_stores/images/millerlight-styles/<key>.png. KV Get Value tells the graph which key is selected; this node loads that key's image. Swap the key and the preview updates automatically - the README's promised behavior, no manual refresh needed.
How it works
It resolves the same path as the path-only node - custom_kv_stores/images/<registry-basename>/<key>.png - then loads it with PIL, converts to RGB, normalizes to float in [0,1], and adds a batch dimension so it's a proper ComfyUI IMAGE tensor. If your key carries an extension (golden.png), that wins over the ext input.
The catch that will bite you: if the file isn't there, it doesn't error. You get a 1×1 placeholder image (torch.zeros) and the path it tried to load. Downstream nodes won't tell you anything is wrong - you just get a blank pixel. If your previews are mysteriously tiny and dark, that's the missing-file signal.
Inputs and outputs
key(string, forceInput) - the registry key whose image you want.registry_path(string, forceInput) - path to the registry JSON, wired from KV Load from Registry'spathoutput.ext(enum) -pngonly, currently.
Outputs:
image(IMAGE) - the loaded tensor, ready for Preview Image or any image input.path(STRING) - the resolved path, handy for debugging or wiring into a save node.
When to reach for it
Use it whenever the image matters downstream, not just for display - reference-image conditioning, image-to-video setups, or any workflow where a style key picks which reference picture gets fed to the model. If you only need the path, use KV Image Path (Registry Key) instead and let ComfyUI's native Preview Image do the loading.
Install and troubleshooting
Standard pack install, no extras:
cd /path/to/ComfyUI/custom_nodes
git clone https://github.com/millerlight/ComfyUI-KVTools.git
Or ComfyUI Manager → Install via URL → https://github.com/millerlight/ComfyUI-KVTools, then restart and hard-reload the browser. requirements.txt is empty - PIL, numpy, and torch are all already in ComfyUI, so there's nothing extra to install.
If a preview comes back blank, don't debug the node - debug the files. Confirm the image exists at the exact constructed path, that its name matches the key (letters, numbers, dots, underscores only), and that registry_path really points at the JSON whose basename forms the folder. That last one is the classic mistake: the folder name is derived from the JSON's name, so my_styles.json expects images in images/my_styles/, not images/my-styles/.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| key | STRING | — | |
| registry_path | STRING | — | |
| ext | COMBO | png | 1 options: png |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| path | STRING | — |