Parse Metadata Flexible
Reverse-engineer any A1111 PNG's settings back into a working workflow
- default_model_info
- positive_string
- negative_string
- seed
- steps
- cfg
- sampler_name
- scheduler
- width
- height
- model_info
- lora_stack
ComfyUI's superpower is that a workflow rides along inside the PNG - "workflow included" became culture. But the older, still-everywhere format is A1111-style metadata: the flat text block under a PNG's parameters key, with Steps:, Sampler:, CFG scale:, Seed:, and the rest. Tons of images on Civitai and Reddit carry that format and nothing else, and rebuilding the settings from a screenshot of a prompt is a chore.
Parse Metadata Flexible is the reverse-engineering half of Sage Utils' metadata story. Give it an A1111 "Full" metadata string and it splits it back out into every component: positive and negative prompts, sampler settings, dimensions, and - the clever part - it tries to resolve the model and LoRAs by hash using the pack's local Civitai cache.
How it works
Feed metadata_string (the raw text block, not the image) and the node parses the familiar A1111 keys. The pack's source shows the whole grammar: Negative prompt: splits the two prompts; Steps:, Sampler:, Scheduler type:/Schedule type:, CFG scale: and Seed: are each extracted; Size: gives width and height. It also handles the Model hash: field and Lora hashes: entries, and cleans <lora:name:weight> tokens out of the prompt while turning them into stack entries.
The sampler name gets the fun treatment: A1111 and ComfyUI call samplers different things, so it reverse-maps Civitai/A1111 names (like "DPM++ 2M Karras") back to ComfyUI's names, pulling the scheduler out at the same time. Model and LoRA hashes are matched against the pack's cache - the same sage_cache_hash.json / sage_cache_info.json files that the metadata-creation side writes - and the matching model_info / lora_stack are handed to you ready for the loader nodes.
The outputs that matter
It's a big output bank, and it's the point:
positive_stringandnegative_string- straight into your prompt nodes or CLIP encoders.seed,steps,cfg,sampler_name,scheduler- the exact generation settings, ready to feed a KSampler or a Sampler Info node.width/height- for Empty Latent Passthrough.model_infoandlora_stack- resolved model and LoRA bundle, wireable into Load Models + Loras and Construct Metadata.
If a field is missing from the metadata, the defaults kick in - default_seed, default_steps (20), default_cfg (7.0), default_sampler (euler), default_scheduler (normal), default_width/default_height (1024), and optionally default_model_info if the hash can't be resolved.
Installation
Same pack as everything else here. ComfyUI Manager, search "Sage Utils", or:
cd ComfyUI/custom_nodes
git clone https://github.com/arcum42/ComfyUI_SageUtils
cd ComfyUI_SageUtils
pip install -r requirements.txt
Restart ComfyUI. Only dependency is dynamicprompts.
Where people get burned
The model-hash resolution only works if the pack has already hashed and cached those files - run Model Scan & Report once so the cache exists, or the lookup silently falls back to default_model_info. And remember the format it speaks: this parses A1111 "Full" format text, not the JSON blobs some newer tools embed. If you're copying metadata out of an image viewer, make sure you grab the parameters block, not a rendered description. For the reverse of this node - building A1111 strings from a workflow - the pack's Construct Metadata nodes are the other half of the same pipeline.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| metadata_string | STRING | The metadata string to parse. | |
| default_seedopt | INT | 0 | Default seed used when the metadata does not specify one. |
| default_stepsopt | INT | 201–10000 | Default steps used when the metadata does not specify them. |
| default_cfgopt | FLOAT | 7.00–100 | Default CFG scale used when the metadata does not specify it. |
| default_sampleropt | COMBO | euler | Default sampler to use when the metadata string does not specify one. |
| default_scheduleropt | COMBO | normal | Default scheduler to use when the metadata string does not specify one. |
| default_widthopt | INT | 1024 | Default width used when the metadata does not specify dimensions. |
| default_heightopt | INT | 1024 | Default height used when the metadata does not specify dimensions. |
| default_model_infoopt | MODEL_INFO | Default model info used when the metadata string does not identify a model. |
Outputs (11)
| Name | Type | Description |
|---|---|---|
| positive_string | STRING | Extracted positive prompt string. |
| negative_string | STRING | Extracted negative prompt string. |
| seed | INT | Extracted seed value. |
| steps | INT | Extracted number of steps. |
| cfg | FLOAT | Extracted CFG scale. |
| sampler_name | COMBO | Extracted sampler name. |
| scheduler | COMBO | Extracted scheduler name. |
| width | INT | Extracted image width. |
| height | INT | Extracted image height. |
| model_info | MODEL_INFO | Extracted default model info from metadata, if available. |
| lora_stack | LORA_STACK | Extracted LoRA stack information from the metadata. |