Commit f517838c authored by Keith's avatar Keith Committed by GitHub

Fix extra networks save preview image geninfo

parent 89f9faa6
...@@ -334,9 +334,19 @@ def setup_ui(ui, gallery): ...@@ -334,9 +334,19 @@ def setup_ui(ui, gallery):
assert is_allowed, f'writing to {filename} is not allowed' assert is_allowed, f'writing to {filename} is not allowed'
if geninfo: if geninfo:
pnginfo_data = PngImagePlugin.PngInfo() ext = os.path.splitext(filename)[1].lower()
pnginfo_data.add_text('parameters', geninfo) if ext == '.png':
image.save(filename, pnginfo=pnginfo_data) pnginfo_data = PngImagePlugin.PngInfo()
pnginfo_data.add_text('parameters', geninfo)
image.save(filename, pnginfo=pnginfo_data)
elif ext in ('.jpg', '.jpeg', '.webp'):
exif_bytes = piexif.dump({
'Exif': {piexif.ExifIFD.UserComment: piexif.helper.UserComment.dump(geninfo or '',
encoding='unicode')}
})
image.save(filename, exif=exif_bytes, quality=shared.opts.jpeg_quality)
else:
image.save(filename)
else: else:
image.save(filename) image.save(filename)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment