diff options
author | AUTOMATIC <16777216c@gmail.com> | 2022-10-14 14:14:24 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2022-10-14 14:14:24 +0000 |
commit | a156c097ab68fd18145547630d32fbab0673ea53 (patch) | |
tree | c13499a44ea40b24b6f25fbf743570ac95c120cf /modules/images.py | |
parent | e644b5a80beb54b6df4caa63fb19d889dd4ceff6 (diff) | |
parent | 54e0051bdd7dea7348825c09600ec61ea0771cb8 (diff) | |
download | stable-diffusion-webui-gfx803-a156c097ab68fd18145547630d32fbab0673ea53.tar.gz stable-diffusion-webui-gfx803-a156c097ab68fd18145547630d32fbab0673ea53.tar.bz2 stable-diffusion-webui-gfx803-a156c097ab68fd18145547630d32fbab0673ea53.zip |
Merge branch 'param-loading'
Diffstat (limited to 'modules/images.py')
-rw-r--r-- | modules/images.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/modules/images.py b/modules/images.py index c0a90676..f1155b7f 100644 --- a/modules/images.py +++ b/modules/images.py @@ -463,3 +463,23 @@ def save_image(image, path, basename, seed=None, prompt=None, extension='png', i txt_fullfn = None
return fullfn, txt_fullfn
+
+
+def image_data(image_path):
+ file, ext = os.path.splitext(image_path.name)
+ data = {}
+ if "png" in ext:
+ image = Image.open(image_path.name, "r")
+ print(f"Image data requested for {image_path.name} {image.format} of {type(image)}")
+ try:
+ data = image.text["parameters"]
+ except Exception as e:
+ print(f"Exception: {e}")
+ pass
+ print(f"Image data: {data}")
+ if "txt" in ext:
+ myfile = open(image_path.name, 'r')
+ data = myfile.read()
+ myfile.close()
+
+ return data, None
|