Reworked MetaSaverNode and MetaSaverDynamicNode to use a fixed number of optional metadata field pairs (10 for standard, 20 for dynamic), removing the num_metadata_fields parameter. Updated documentation in README.md and added a new QUICKSTART.md guide to reflect the simplified usage and clarify how to add custom metadata fields.
3.2 KiB
3.2 KiB
MetaSaver Quick Start Guide
TL;DR
- Add "Save Image with Custom Metadata" node
- Fill in field names and connect values
- Leave unused fields empty
- Done!
How It Works
The node shows you pairs of inputs like this:
meta_name_0: [text input] meta_value_0: [any connection]
meta_name_1: [text input] meta_value_1: [any connection]
meta_name_2: [text input] meta_value_2: [any connection]
...
To Add Metadata:
- Type a name in
meta_name_X(e.g., "seed", "prompt", "cfg_scale") - Connect a value to
meta_value_X(from any node output) - Repeat for as many fields as you need
- Leave the rest empty
Example:
meta_name_0: "seed" meta_value_0: ← connected from KSampler seed
meta_name_1: "positive_prompt" meta_value_1: ← connected from CLIP Text Encode
meta_name_2: "cfg_scale" meta_value_2: ← connected from KSampler cfg
meta_name_3: "" meta_value_3: [empty - ignored]
meta_name_4: "" meta_value_4: [empty - ignored]
What Gets Saved?
Your metadata is embedded in the PNG file in two formats:
-
Structured JSON (in
custom_metadatafield):{ "seed": 12345, "positive_prompt": "beautiful landscape", "cfg_scale": 7.5 } -
Individual fields (as
meta_seed,meta_positive_prompt, etc.)
Reading Metadata
Drag back into ComfyUI
Just drag the PNG into ComfyUI to restore the workflow!
Python
from PIL import Image
import json
img = Image.open("output.png")
metadata = json.loads(img.info["custom_metadata"])
print(metadata)
Command Line
python examples/read_metadata.py output.png
Tips
- Empty = Ignored: Fields with empty names are skipped
- Any Type:
meta_value_Xaccepts ANY data type - Standard vs Dynamic:
- Standard = 10 field pairs
- Dynamic = 20 field pairs
- No Limit on Name Length: Field names can be descriptive
Common Patterns
Pattern: Track Everything
meta_name_0: "seed" → KSampler seed
meta_name_1: "steps" → KSampler steps
meta_name_2: "cfg" → KSampler cfg
meta_name_3: "sampler" → KSampler sampler_name
meta_name_4: "scheduler" → KSampler scheduler
meta_name_5: "model" → CheckpointLoader name
Pattern: Just Prompts
meta_name_0: "positive" → Positive CLIP Text
meta_name_1: "negative" → Negative CLIP Text
Pattern: A/B Testing
meta_name_0: "test_id" → Custom string "test_001"
meta_name_1: "variation" → Custom string "red_background"
meta_name_2: "seed" → KSampler seed
Troubleshooting
Q: I don't see all the fields! A: Scroll down in the node - they're all there (10 or 20 pairs depending on version)
Q: My metadata isn't saving! A: Make sure the field name is filled in (not empty)
Q: Can I use the same field name twice? A: Yes, but the last one will overwrite earlier ones. Use unique names.
Q: What if I need more than 10/20 fields? A: Use two MetaSaver nodes, or open a GitHub issue to request more!
Next Steps
- See USAGE.md for detailed examples
- See README.md for full documentation
- Use
examples/read_metadata.pyto inspect saved metadata
Happy saving! 🎨