From 06d79850ac59fdf7789cbf43fa1131400e3a3c96 Mon Sep 17 00:00:00 2001 From: bakatrouble Date: Tue, 12 Nov 2019 20:52:08 +0300 Subject: [PATCH] fix channel helper --- bots/modules/channel_helper.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bots/modules/channel_helper.py b/bots/modules/channel_helper.py index 47ed717..6f3758d 100644 --- a/bots/modules/channel_helper.py +++ b/bots/modules/channel_helper.py @@ -40,12 +40,10 @@ class ChannelHelperBotModuleConfig(TelegramBotModuleConfig): width, height = im.size if width > 2000 or height > 2000: im.thumbnail((2000, 2000)) + im = im.convert('RGB') with tempfile.TemporaryDirectory() as d: fpath = os.path.join(d, '{}.jpg'.format(uuid4())) - background = Image.new('RGBA', im.size, (255, 255, 255)) - alpha_composite = Image.alpha_composite(background, im) - alpha_composite = alpha_composite.convert('RGB') - alpha_composite.save(fpath) + im.save(fpath) self.bot.get_bot().send_photo(self.chat_id, open(fpath, 'rb')) return True