mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
correct bug when trying to enhance JPG images (#1928)
This fix was authored by @mebelz and is reissued here to base it on `main`.
This commit is contained in:
parent
7efe0f3996
commit
f745f78cb3
@ -57,8 +57,13 @@ def retrieve_metadata(img_path):
|
||||
metadata stored there, as a dict
|
||||
'''
|
||||
im = Image.open(img_path)
|
||||
md = im.text.get('sd-metadata', '{}')
|
||||
dream_prompt = im.text.get('Dream', '')
|
||||
if hasattr(im, 'text'):
|
||||
md = im.text.get('sd-metadata', '{}')
|
||||
dream_prompt = im.text.get('Dream', '')
|
||||
else:
|
||||
# When trying to retrieve metadata from images without a 'text' payload, such as JPG images.
|
||||
md = '{}'
|
||||
dream_prompt = ''
|
||||
return {'sd-metadata': json.loads(md), 'Dream': dream_prompt}
|
||||
|
||||
def write_metadata(img_path:str, meta:dict):
|
||||
|
Loading…
Reference in New Issue
Block a user