aboutsummaryrefslogtreecommitdiff
path: root/modules/images.py
diff options
context:
space:
mode:
authord8ahazard <d8ahazard@gmail.com>2022-10-12 18:17:26 -0500
committerd8ahazard <d8ahazard@gmail.com>2022-10-12 18:17:26 -0500
commit54e0051bdd7dea7348825c09600ec61ea0771cb8 (patch)
tree78c225890f9e9700a9af209d5855622e9beb8522 /modules/images.py
parentcc5803603b8591075542d99ae8596ab5b130a82f (diff)
Add drag/drop param loading.
Drop an image or generational text onto the prompt bar, it loads the info for parsing.
Diffstat (limited to 'modules/images.py')
-rw-r--r--modules/images.py20
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