How to get full-size images from Telegram Bot downloads?

Hey everyone,

I’ve been working on a Telegram bot and I’m running into a weird issue. I’m trying to download image files that users send to the bot. The download seems to work, but there’s a problem with the file size.

When I use the getFile method to download an image, it completes without any errors. However, the image file I end up with is tiny - only about 1.7 KB. This is way smaller than the original image on my phone.

Has anyone else run into this? Is there a setting I’m missing that’s causing the bot to download a compressed version instead of the full-size image? Or maybe I’m using the wrong method altogether?

I’d really appreciate any tips or suggestions on how to get the full-size images. Thanks in advance for your help!

yo, i had this prob too. make sure ur usin the right URL to grab the file. u need the file_path from getFile(), not just the file_id. then do smthn like:

https://api.telegram.org/file/bot/<file_path>

that shud get u the full-size pic. good luck!

I’ve dealt with this exact issue before, and it can be pretty frustrating. The problem is likely that you’re downloading the file_id instead of the actual file. After getting the file_id, you need to call getFile() to get the file_path. Then, construct the download URL using the bot’s token and that file_path.

Something like:
https://api.telegram.org/file/bot<YOUR_BOT_TOKEN>/<file_path>

Use this URL to download the full-size image. Make sure you’re handling large files properly - some images can be quite big.

Also, double-check your bot’s permissions. It needs the right access to download files.

Hope this helps! Let me know if you need any clarification on the steps.