mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fe12c6c099
commit67fbaa7c31
Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Sep 16 16:57:54 2022 -0400 reconciled conflicting changes to pngwriter call commitddc68b01f7
Merge:f9feaac
cbac95b
Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Sat Sep 17 06:39:22 2022 +1000 Merge remote-tracking branch 'upstream/development' into development commitf9feaac8c7
Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Sat Sep 17 06:16:16 2022 +1000 Fixes metadata related to new args commitd1de1e357a
Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Sat Sep 17 06:15:55 2022 +1000 Fixes PromptFormatter import bug
23 lines
704 B
Python
23 lines
704 B
Python
#!/usr/bin/env python
|
|
|
|
import sys
|
|
import json
|
|
from ldm.dream.pngwriter import retrieve_metadata
|
|
|
|
if len(sys.argv) < 2:
|
|
print("Usage: file2prompt.py <file1.png> <file2.png> <file3.png>...")
|
|
print("This script opens up the indicated dream.py-generated PNG file(s) and prints out their metadata.")
|
|
exit(-1)
|
|
|
|
filenames = sys.argv[1:]
|
|
for f in filenames:
|
|
try:
|
|
metadata = retrieve_metadata(f)
|
|
print(f'{f}:\n',json.dumps(metadata['sd-metadata'], indent=4))
|
|
except FileNotFoundError:
|
|
sys.stderr.write(f'{f} not found\n')
|
|
continue
|
|
except PermissionError:
|
|
sys.stderr.write(f'{f} could not be opened due to inadequate permissions\n')
|
|
continue
|