Nodes/ComfyUI-mnemic-nodes/πŸ–ΌοΈπŸ“Š Metadata Extractor (Single)
ComfyUI Node

πŸ–ΌοΈπŸ“Š Metadata Extractor (Single)

Read Someone Else's Settings Back Out of Their PNG

By MNeMoNiCuZΒ·Created 3 years agoΒ·Updated a day agoΒ· 105
πŸ–ΌοΈπŸ“Š Metadata Extractor (Single)
  • image_input
  • image
  • positive_prompt
  • negative_prompt
  • parsed_params_json
  • filtered_params_list
  • raw_metadata_json
β—„seed0β–Ί
β—„input_pathβ–Ί
β—„filter_paramsβ–Ί

Generation settings live inside the image file. That's the deal in this ecosystem: a PNG carries the workflow that made it in its text chunks, which is why dragging one back onto the canvas rebuilds the graph. πŸ–ΌοΈπŸ“Š Metadata Extractor (Single) reads those chunks - and the A1111-style parameters block - and hands you the prompts and settings as ordinary strings you can use inside a workflow, instead of in a browser tab next to it.

Reach for it when you're reverse-engineering. Someone posts a photo you like on Civitai, you download the original, and you want the prompt and sampler values as text you can pipe into a text-to-image run rather than manually retyping.

How it works

Two sources, and the difference matters more than anything else about this node.

If input_path points at a PNG, the node reads the file's text chunks into raw_metadata_json and then parses the chunk keyed parameters - the flat A1111/Forge string (Steps: 30, Sampler: DPM++ 2M, CFG scale: 5, Seed: ...). From that it fills positive_prompt, negative_prompt, and a params dict. The recognised keys are fixed: steps, sampler, cfg scale, seed, size, model, denoising strength, clip skip, hires upscale, hires steps, hires upscaler, lora hashes.

If input_path points at a JPEG or TIFF, it goes through EXIF instead and gives you the raw EXIF dictionary - but no parsed params, no prompts. That's a real limitation, not a bug: the parser specifically looks for the PNG parameters chunk.

And the trap: ComfyUI's own SaveImage does not write a parameters chunk. It writes prompt and workflow (JSON of the graph). So point this node at a ComfyUI-native PNG and you get a full raw_metadata_json with your whole graph inside, and empty prompts. If you want this node to work on your own output, save through a node that also emits A1111-style parameters - the same pack's "Save Image With Metadata" does exactly that - or just use the Civitai-side original, which usually kept it.

seed is an index, not a seed: with a folder path, seed % file_count picks the file from an alphabetically sorted list, and it ships with increment already set on control_after_generate so repeated queues walk the folder.

Inputs and outputs

Set input_path (file or folder; relative paths resolve against ComfyUI/input), optionally wire image_input instead, and optionally list filter_params like steps, sampler, cfg scale. Note the exact key names - cfg scale, not cfg; a key the parser doesn't know returns an empty line.

Outputs: image, positive_prompt, negative_prompt, parsed_params_json, filtered_params_list, raw_metadata_json. filtered_params_list is one value per line in the order you asked, which is designed to be chopped by the String Text Splitter from this same pack. Nothing loaded? You get a 64x64 black image and {}, not an exception.

Wiring image_input disables metadata entirely. The node can't read tags off a tensor, so it returns empty prompts. That's what the path input is for.

Install

ComfyUI Manager β†’ "ComfyUI-mnemic-nodes" β†’ restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/MNeMoNiCuZ/ComfyUI-mnemic-nodes

The pack installs piexif (EXIF reading), transformers, opencv-python and friends via requirements.txt. No model downloads, no API keys.

Common issues

Prompts come back empty on a ComfyUI PNG. Expected - see above. Read raw_metadata_json instead, or re-save through an A1111-parameters-writing node.

filter_params returns blank lines. Your keys don't match the parser's vocabulary. Use the exact names quoted earlier.

Metadata is simply gone. Anything that re-encoded the file - Reddit's image host, a screenshot, a JPEG export, an editor round-trip - destroyed the chunks. There is no recovery from pixels.

Category⚑ MNeMiC Nodes

Inputs (4)

NameTypeDefaultDescription
seedINT00–18446744073709550000Index of the file to load from a folder, starting at 0. Increments every run by default to step through the folder.
input_pathoptSTRINGPath to a single image file or a directory of images.
image_inputoptIMAGEA single image. If a list/batch is provided, the seed will select one. This has priority over input_path.
filter_paramsoptSTRINGA comma-separated list of keys to extract (e.g., steps, sampler, seed).

Outputs (6)

NameTypeDescription
imageIMAGEThe image the metadata was read from. A 64x64 black image if nothing could be loaded.
positive_promptSTRINGPositive prompt found in the image metadata. Empty if there is none.
negative_promptSTRINGNegative prompt found in the image metadata. Empty if there is none.
parsed_params_jsonSTRINGAll recognised generation settings (steps, sampler, cfg, seed, ...) as indented JSON.
filtered_params_listSTRINGJust the keys named in filter_params, one value per line, in the order requested.
raw_metadata_jsonSTRINGThe unparsed metadata block from the file, as indented JSON.