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)
|
caption=caption)
|
||||||
elif post.file.ext in ('png', 'jpg'):
|
elif post.file.ext in ('png', 'jpg'):
|
||||||
if post.file.size > 10000000:
|
if post.file.size > 10000000:
|
||||||
im = Image.open(file)
|
dl_im = Image.open(file).convert('RGBA')
|
||||||
im.thumbnail((2048, 2048), Image.LANCZOS)
|
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)
|
file.truncate(0)
|
||||||
im.save(file, format='JPEG')
|
composite.save(file, format='JPEG')
|
||||||
im.seek(0)
|
file.seek(0)
|
||||||
await bot.send_photo(int(os.environ['SEND_CHAT']),
|
await bot.send_photo(int(os.environ['SEND_CHAT']),
|
||||||
file,
|
file,
|
||||||
caption=caption)
|
caption=caption)
|
||||||
|
Loading…
Reference in New Issue
Block a user