From 2aca613a61ac98bb008f6dca2594295743593804 Mon Sep 17 00:00:00 2001 From: w-e-w <40751091+w-e-w@users.noreply.github.com> Date: Mon, 29 May 2023 07:30:32 +0900 Subject: [PATCH] fix disable png info --- modules/images.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/images.py b/modules/images.py index e21e554c..6f91c52c 100644 --- a/modules/images.py +++ b/modules/images.py @@ -511,9 +511,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)