diff --git a/modules/images.py b/modules/images.py index b6f2358c3..ebd3a9014 100644 --- a/modules/images.py +++ b/modules/images.py @@ -548,6 +548,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"):