From 4df9c68d78d508006d7cc00edb6ac7a24968ddf6 Mon Sep 17 00:00:00 2001 From: bakatrouble Date: Tue, 12 Nov 2019 20:44:57 +0300 Subject: [PATCH] fix png --- bots/modules/channel_helper.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bots/modules/channel_helper.py b/bots/modules/channel_helper.py index 270f36a..ae3ad44 100644 --- a/bots/modules/channel_helper.py +++ b/bots/modules/channel_helper.py @@ -42,7 +42,9 @@ class ChannelHelperBotModuleConfig(TelegramBotModuleConfig): im.thumbnail((2000, 2000)) with tempfile.TemporaryDirectory() as d: fpath = os.path.join(d, '{}.jpg'.format(uuid4())) - im.save(fpath) + background = Image.new('RGBA', im.size, (255, 255, 255)) + alpha_composite = Image.alpha_composite(background, im) + alpha_composite.save(fpath) self.bot.get_bot().send_photo(self.chat_id, open(fpath, 'rb')) return True