KIE • Element Reference
The actual picture of that location you saved
- element
- reference_image
- element_prompt
What it is
This is the third of the pack's three element nodes, and it's the simplest: it takes a saved Element and hands you back its approved image as an IMAGE socket.
KIE • Save Element stores a versioned location, prop, or style. KIE • Load Element gives you the handle and the text brief. KIE • Element Reference gives you the pixels. If you're feeding a model that documents image-reference support - Nano Banana, Seedream edit, Kling's reference modes - this is the node that goes on that input. It also re-emits the element's prompt text, so you can drive the prompt from the same record without wiring two nodes.
How it works
Connect an Element and the node reads that element's folder from Comfy's user data area, then does a chain of checks before it hands you anything:
- The element must be inside the active Elements library - a path outside your user data folder is rejected, not followed.
- The saved manifest's
content_sha256must match the one carried on the handle. If someone edited the manifest since your workflow loaded, this fails rather than serving you the wrong version. - The record must name a
reference_image. Styles are allowed to be text-only, so a style with no picture gives you a clear error rather than an empty tensor. - The image file itself is hashed and compared to the hash stored at save time. If the PNG changed on disk, the node refuses.
That's a lot of hashing for a loader, but it's the point of the feature: the reference you approved is the reference that gets used. Consistency work falls apart silently when a reference image drifts, and this makes the drift loud.
The element_prompt it returns alongside is the same assembled text the Load node gives you: "{Kind} reference: {name}.", then the visual definition, then your continuity rules if you wrote any.
Inputs and outputs
One required input - element of type KIE_ELEMENT - which means you can't start here. It only accepts a handle from KIE • Save Element or KIE • Load Element in the same graph, or a re-loaded handle if you saved the element in an earlier session.
Outputs:
reference_image- the approvedIMAGE, ready for a model's reference socket.element_prompt- the STRING brief, so the text and the picture travel together.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/felipederosilva/ComfyUI-KIE-Nodes-Next
python -m pip install -r ComfyUI-KIE-Nodes-Next/requirements.txt
Pillow and numpy decode the PNG. No API key is needed for this node - it's local file I/O; the key only matters when you wire the image into something that generates.
Where people get burned
- "This style has no image." Save Element lets styles be text-only. If you want a style reference image, save a version of the style that includes one - a new version, not an edit.
- "Connect a saved or loaded Element." You wired something that isn't an element handle, or wired nothing at all. The socket is typed, so this usually shows up as a red link, but a loaded workflow with a missing node can still reach execution.
- "Element reference does not match its saved version." The element was re-saved with different content between your graph loading and running. Re-add the node and pick the current version.
- Version bumps are deliberate. Changing the description or the image means a new version; the same name and version can never hold different content. That's what makes it safe to reuse a reference across projects, and it's also why you can't quietly fix a typo in place.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| element | KIE_ELEMENT | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| reference_image | IMAGE | — |
| element_prompt | STRING | — |