fix channel helper
This commit is contained in:
parent
e39bbcf767
commit
06d79850ac
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user