Merge pull request #14958 from HTYISABUG/dev

Error handling for unsupported transparency
This commit is contained in:
AUTOMATIC1111 2024-03-04 18:40:16 +03:00 committed by GitHub
commit 5625ce1b1a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -551,6 +551,12 @@ def save_image_with_geninfo(image, geninfo, filename, extension=None, existing_p
else:
pnginfo_data = None
# Error handling for unsupported transparency in RGB mode
if (image.mode == "RGB" and
"transparency" in image.info and
isinstance(image.info["transparency"], bytes)):
del image.info["transparency"]
image.save(filename, format=image_format, quality=opts.jpeg_quality, pnginfo=pnginfo_data)
elif extension.lower() in (".jpg", ".jpeg", ".webp"):