@
@
@ _ @2021-08-19 21:42:37
Python
@ _ @, 2021-08-19 21:42:37

I send one picture to the bot's telegram, and the bot receives 4. What's the matter?

I am writing a telegram bot in python using aiogram.
Set up taking photos by the bot.
For the sake of interest, I decided to see what the photo transferred to the bot through print(message.photo).
I got several slightly different instances of the same photo as output

[<aiogram.types.photo_size.PhotoSize object at 0x000001A8AA2936D0>, <aiogram.types.photo_size.PhotoSize object at 0x000001A8AA2938B0>, <aiogram.types.photo_size.PhotoSize object at 0x000001A8AA2937C0>]
611ea5e9eed8a797491801.png
Why is this happening?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Krostelev, 2021-08-19
@DaniilOLD

Telegram stores several copies of photos in different sizes, most likely to facilitate their display in clients. If the photo is large, and you only need to display a thumbnail, then it is better to take a finished thumbnail right away than to resize the original each time.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question