Send Image with Compression
Hi, how can send photo with compression?
what do you mean by 'compression'? HTTP compression?
Hi @MrRoundRobin, thanx for replay When you want to send e photo by "Desktop Telegram Client" you have 2 options:
- without compression
- with compression
If you send photo without compression, receiver client must manually download photo and view preview, but when you send photo "with compression" receiver client automatically download it and can view photo preview. New, I want send photo and want client directly can view photo preview (without click and download manually)
I think he mean the like the way when a person use from telegram Desktop client, and Drag a photo the chat, then it can be choosed through "Send with compression" and "Send without compression".
So, if you mean this, you can check if a Photo size is more than specific size (which i dont know whats the max size for sending a photo with a bot maybe 10MB) then you Make a compression with a compression method, after that if the file size still is more than 10MB, send it through SendDocumentAsync method instead.
Update: Yes seems he exactly meant that i didnt read last message first, and plus to this, @MrRoundRobin Can you tell whats the max size possible for SendPhotoAsync, coz in telegram documentation not said anything about it. Also i tested and choosed 12MB photo and occured an exception with this message "PHOTO_SAVE_FILE_INVALID".
@D4NTESPARDA I also don't know. you can ask @BotSupport to include in docs.
@D4NTESPARDA I also don't know. you can ask @BotSupport to include in docs.
@MrRoundRobin I asked em, as i guessed they said it`s around 10MB, but i asked again for the accurate size and no answer still.
When you use the SendPhoto method, it seems to automatically send it as an image (ie "with compression") and when you use the SendDocument methoid, it seems to send the full file (ie "without compression"). For example if you send a gif you must send it using SendDocument in order for them to get a playable gif on the other end.
When you use the SendPhoto method, it seems to automatically send it as an image (ie "with compression") and when you use the SendDocument methoid, it seems to send the full file (ie "without compression"). For example if you send a gif you must send it using SendDocument in order for them to get a playable gif on the other end.
sure it do that, but i think he meant a separate way coz for some large photos it can't compress em lower than about 10MB, but ofc when you send a large size photo with SendPhoto method, it compress that it self and break to n array of type PhotoSize and just send [length-2]th of the array.
Actually, i believe its quite simple. if you send the photo via SendPhoto it should compress it, if you send it via SendDocument it won't be compressed. @sorenaa EDIT: sorry for just repeating what others said, but that's just the way it is. I tested it.