fix
This commit is contained in:
parent
e39e45b6ce
commit
acbdefa508
10
main.py
10
main.py
@ -65,11 +65,13 @@ async def check_updates():
|
||||
caption=caption)
|
||||
elif post.file.ext in ('png', 'jpg'):
|
||||
if post.file.size > 10000000:
|
||||
im = Image.open(file)
|
||||
im.thumbnail((2048, 2048), Image.LANCZOS)
|
||||
dl_im = Image.open(file).convert('RGBA')
|
||||
dl_im.thumbnail((2048, 2048), Image.LANCZOS)
|
||||
im = Image.new('RGBA', dl_im.size, (255, 255, 255))
|
||||
composite = Image.alpha_composite(im, dl_im).convert('RGB')
|
||||
file.truncate(0)
|
||||
im.save(file, format='JPEG')
|
||||
im.seek(0)
|
||||
composite.save(file, format='JPEG')
|
||||
file.seek(0)
|
||||
await bot.send_photo(int(os.environ['SEND_CHAT']),
|
||||
file,
|
||||
caption=caption)
|
||||
|
Loading…
Reference in New Issue
Block a user