Load palletized images as RGBA (Fix #175)

This commit is contained in:
Travis Abendshien
2024-05-18 17:32:54 -07:00
parent e94c4871d7
commit 9d7609a8e5

View File

@@ -122,14 +122,12 @@ class ThumbRenderer(QObject):
if extension in IMAGE_TYPES:
try:
image = Image.open(filepath)
# image = self.thumb_debug
if image.mode != "RGB" and image.mode != "RGBA":
image = image.convert(mode="RGBA")
if image.mode == "RGBA":
# logging.info(image.getchannel(3).tobytes())
new_bg = Image.new("RGB", image.size, color="#1e1e1e")
new_bg.paste(image, mask=image.getchannel(3))
image = new_bg
if image.mode != "RGB":
image = image.convert(mode="RGB")
image = ImageOps.exif_transpose(image)
except DecompressionBombError as e: