From 3b9dda7706126e1ed7048c2f7595dd2294beb522 Mon Sep 17 00:00:00 2001 From: nexy7574 Date: Tue, 14 May 2024 17:24:43 +0100 Subject: [PATCH] Convert JPEG to RGB, not RGBA --- src/cogs/ffmeta.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cogs/ffmeta.py b/src/cogs/ffmeta.py index 0d4a2c3..0469a3f 100644 --- a/src/cogs/ffmeta.py +++ b/src/cogs/ffmeta.py @@ -23,6 +23,8 @@ class FFMeta(commands.Cog): def jpegify_image(self, input_file: io.BytesIO, quality: int = 50, image_format: str = "jpeg") -> io.BytesIO: quality = min(1, max(quality, 100)) img_src = PIL.Image.open(input_file) + if image_format == "jpeg": + img_src = img_src.convert("RGB") img_dst = io.BytesIO() self.log.debug("Saving input file (%r) as %r with quality %r%%", input_file, image_format, quality) img_src.save(img_dst, format=image_format, quality=quality)