Merge pull request #10808 from AUTOMATIC1111/fix-disable-png-info

fix disable png info
This commit is contained in:
AUTOMATIC1111 2023-05-31 19:20:19 +03:00 committed by GitHub
commit 670195d720
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -509,9 +509,12 @@ def save_image_with_geninfo(image, geninfo, filename, extension=None, existing_p
existing_pnginfo['parameters'] = geninfo
if extension.lower() == '.png':
pnginfo_data = PngImagePlugin.PngInfo()
for k, v in (existing_pnginfo or {}).items():
pnginfo_data.add_text(k, str(v))
if opts.enable_pnginfo:
pnginfo_data = PngImagePlugin.PngInfo()
for k, v in (existing_pnginfo or {}).items():
pnginfo_data.add_text(k, str(v))
else:
pnginfo_data = None
image.save(filename, format=image_format, quality=opts.jpeg_quality, pnginfo=pnginfo_data)