Load Image & Extract Metadata
One Node That Loads an Image AND Hands You Its Prompt
- image
- image_path
- metadata_json
Half image loader, half metadata thief. Give it an image path and you get two things at once: a proper IMAGE tensor you can feed to img2img or ControlNet, and a string containing whatever metadata is embedded in the file - which for a ComfyUI PNG usually means the full workflow JSON, i.e. the prompt and every setting that made that image. Download a cool image with "workflow included" in the description, drop its path in here, and you've got the recipe without dragging the file through the whole load-and-extract song and dance.
How it works
The image side is a standard PIL load: it opens the file, applies exif_transpose so phone photos don't arrive sideways, converts to RGB, normalizes to a float tensor, and returns it in ComfyUI's IMAGE format. There's also an upload handler registered, so instead of typing a path you can use the node's upload button and it stashes the file in ComfyUI's temp directory.
The metadata side is a small detective routine. It opens the PNG and checks its text chunks in a specific order: parameters (the key A1111 and friends use), then prompt, then workflow (ComfyUI's full graph JSON), then ComfyUI, and finally - if none of those exist - it dumps every metadata field it can find as a JSON object.
Inputs and outputs
Only one input: image_path (optional, defaults to empty). Outputs are:
image- theIMAGEtensor, same shape expectations as the built-in Load Image.image_path- echoes the path back, handy for passing along to other nodes.metadata_json- the extracted metadata. Here's the honest part: the name oversells it. ComfyUI'sworkflowchunk is JSON, but A1111'sparameterschunk is plain text, and this node returns whatever it found verbatim. It's a string either way; wire it into a text node or into something likeExtractPromptFromJsonTlantto pull a specific field out.
Install
It's one of sixteen nodes in the Tlant pack, so install is the pack install:
cd ComfyUI/custom_nodes
git clone https://github.com/Tlant/ComfyUI-OllamaPromptsGeneratorTlant
or via ComfyUI Manager ("Load Image & Extract Metadata"). Restart after cloning. No extra dependencies beyond what ComfyUI already has (PIL, numpy, torch).
Where people get burned
- Empty
image_pathraises. This node doesn't silently no-op - with no path it raisesValueError, which surfaces as an execution error. Use the upload button or type a real path. - Missing file, missing metadata. A bad path gives
FileNotFoundError. And if the PNG was stripped or saved by a tool that removes text chunks, you get back{}- the image loads fine, the metadata side just comes up empty. - It's not actually JSON. Because the output can be raw A1111-style parameter text, don't assume you can
json.loadsthemetadata_jsonoutput. Check what you got before feeding it to a JSON node.
It's a tidy little two-for-one: load the image and pull the recipe out of it in a single node. For reverse-engineering other people's workflows it's hard to beat.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| image_pathopt | STRING | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| image_path | STRING | — |
| metadata_json | JSON | — |