Compress to KB topic guide
Compress images for Telegram bots: hit the sendPhoto 10 MB cap
Direct answer
When a bot calls sendPhoto, Telegram treats the upload as an inline photo, not a generic file. The Bot API states the photo must be at most 10 MB in size, that width and height must not exceed 10000 in total, and that the width-to-height ratio must be at most 20. If your JPEG or PNG is headed for sendPhoto, compress to a deliberate KB budget under 10 MB before the multipart upload — even when the same bytes might fit under sendDocument’s higher file cap.
What this workflow handles
Treat sendPhoto’s 10 MB ceiling as the pre-compression check for inline bot photos on the default cloud Bot API. The Sending Files section of the Bot API repeats a 10 MB maximum for photos in multipart/form-data uploads and 50 MB for other files — use sendDocument (or sendVideo/sendAnimation as appropriate) when the bot should deliver a file attachment instead of a photo message. If the bot sends a photo by URL rather than upload, the Bot API documents a lower 5 MB cap for photos (20 MB for other content) — compress for the path your integration actually uses. Dimension rules matter alongside bytes: width plus height must not exceed 10000 total, and aspect ratio must be at most 20. Prefer JPEG for photographs; use PNG for sharp UI screenshots. Enter a Compress to KB target under 10240 KB (commonly 8000–9500 KB), quality-sweep at the original dimensions first when pixels already fit Telegram’s rules, and downscale only if the quality floor still misses the budget or you exceed the dimension sum. Self-hosted local Bot API servers can accept uploads up to 2000 MB — that caveat does not change the default cloud sendPhoto 10 MB rule. Beita’s Compress to KB uses a temporary analysis upload with no long-term storage; see the Privacy Policy for retention details.
Use Compress to KB with a target under 10240 KB (for example 8000–9500 KB) before your bot calls sendPhoto. For a 50 MB file send via sendDocument instead, you may not need this tight cap — see the Bot API Sending Files section. For GitHub’s separate 10 MB issue attachment rule, see Compress image for GitHub.
How to use it
- Open the Bot API sendPhoto docs and decide whether the bot should send an inline photo (sendPhoto, 10 MB) or a file (sendDocument, up to 50 MB per Sending Files / bots FAQ).
- Check width plus height ≤ 10000 total and aspect ratio ≤ 20; resize if pixels break those rules before you compress bytes.
- Pick JPEG for photos and PNG for sharp screenshots; if the bot sends by URL, remember the 5 MB photo-by-URL cap in Sending Files.
- Enter a Compress to KB target under 10240 KB (commonly 8000–9500 KB), quality-sweep at the current dimensions first, and allow stepped downscale only if the quality floor still exceeds the budget.
- Upload the compressed file through your bot’s sendPhoto path and re-read Telegram’s error if validation still fails — local Bot API servers may allow much larger uploads, but the default cloud API does not.
Frequently asked questions
What is Telegram Bot API sendPhoto’s size limit?
The Bot API sendPhoto method states the photo must be at most 10 MB in size. The same page documents that the photo’s width and height must not exceed 10000 in total and that the width-to-height ratio must be at most 20. Treat 10240 KB as the byte ceiling and aim slightly lower for encoding headroom.
When should the bot use sendDocument instead of sendPhoto?
Use sendPhoto when you want an inline photo in the chat. Use sendDocument when the payload should arrive as a file. The Bot API Sending Files section caps multipart photo uploads at 10 MB but allows other files up to 50 MB. The bots FAQ also notes bots can send files of any type up to 50 MB. A 15 MB PNG might fit as a document but fail sendPhoto — pick the method first, then compress to that method’s published cap.
Does sending a photo by URL use the same 10 MB limit?
Not always. The Bot API Sending Files section lists separate limits when content is sent by URL: 5 MB maximum for photos and 20 MB for other content. If your bot passes a photo URL to sendPhoto instead of uploading multipart data, plan for the 5 MB photo-by-URL cap unless Telegram’s docs for your exact call path say otherwise.
What KB target should I use in Compress to KB?
Start from 10240 KB (10 MB) for sendPhoto uploads and leave headroom: 8000–9500 KB is a practical target for a single inline photo. Quality-sweep first at the original pixel dimensions when width plus height already respect the 10000 total rule; allow stepped downscale only if the quality floor still exceeds the budget or pixels break Telegram’s dimension rules. web.dev’s compress-images guide recommends experimenting with quality rather than assuming one universal setting.
JPEG or PNG for Telegram bot photos?
Prefer JPEG for photographs sent with sendPhoto. Use PNG when you need sharp UI text or flat graphics. Both count against the same sendPhoto byte and dimension rules — pick the format that stays readable after compression.
How does getFile’s download limit relate to sendPhoto?
Upload and download limits are separate. The bots FAQ states bots can send files up to 50 MB but can download files via getFile only up to 20 MB. This page focuses on compressing before sendPhoto’s 10 MB inline photo upload; larger outbound files may use sendDocument within the 50 MB send cap.
How is this different from the GitHub, Discord, WhatsApp, and email guides?
compress-image-for-github covers GitHub Docs 10 MB image and GIF attachments on issues and pull requests — same 10 MB number, different product and API. compress-image-for-discord covers Discord Support 20 MB free per-file chat uploads. compress-image-for-whatsapp covers Meta Cloud API 5 MB JPEG/PNG image messages — same 5 MB number as LinkedIn share photos, different product and API. compress-image-for-linkedin covers LinkedIn Help 5 MB share-box photo uploads. compress-image-for-instagram covers Instagram Graph API 8 MB JPEG feed, Story, and Reels cover uploads. compress-image-for-twitter covers X API 5 MB tweet_image/dm_image still images (animated GIF 15 MB separately). compress-image-for-notion covers Notion Help 5 MB inline PNG/JPG display. compress-image-for-wordpress covers WordPress Media Library upload limits and the 2560 px big-image threshold. compress-image-for-facebook covers Meta Help Center Facebook photo upload size, format, and PNG guidance. compress-image-for-pinterest covers Pinterest Help web Image Pin uploads (20 MB; BMP, JPEG, PNG, TIFF, WEBP). compress-image-for-youtube covers YouTube Help custom thumbnails (50 MB desktop; 50 MB mobile video, 10 MB mobile podcasts; JPG or PNG). compress-image-for-threads covers Threads API 8 MB JPEG/PNG image posts (width 320–1440, aspect up to 10:1). compress-image-for-email covers Gmail and Outlook.com 25 MB message attachment totals. compress-image-to-kb covers forms and marketplaces (GOV.UK, LinkedIn profile, Shopify). This page isolates Telegram Bot API sendPhoto rules from core.telegram.org. Same Compress to KB tool; different destination budget.
Sources
- Telegram Bot API — sendPhoto: https://core.telegram.org/bots/api#sendphoto — Photo at most 10 MB; width and height must not exceed 10000 in total; width-to-height ratio at most 20.
- Telegram Bot API — Sending files: https://core.telegram.org/bots/api#sending-files — Multipart upload: 10 MB max for photos, 50 MB for other files; by URL: 5 MB max for photos, 20 MB for other content; local Bot API server upload up to 2000 MB.
- Telegram bots FAQ: https://core.telegram.org/bots/faq — Bots can send files of any type up to 50 MB; getFile download up to 20 MB.
- web.dev — Compress images: https://web.dev/articles/compress-images — Experiment with quality settings; there is no one universal compression setting.
- Pillow — Image.save (JPEG quality, optimize): https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html#jpeg — JPEG quality and optimize parameters used in the quality sweep behind Compress to KB.
Explore the compress to kb topic cluster
This guide covers Telegram Bot API sendPhoto size and dimensions. Related guides cover general KB budgets, email, WhatsApp, LinkedIn share photos, Instagram Graph JPEG caps, Twitter / X still-image caps, Notion inline image caps, WordPress Media Library caps, Facebook Help photo upload caps, Pinterest web Image Pin caps, GitHub, and Discord caps, and the Compress to KB tool.
Related guides
-
Compress image to KB
General hard byte-budget workflow for forms and marketplaces.
-
Compress images for email
Gmail and Outlook.com 25 MB attachment caps.
-
Compress images for WhatsApp
Meta Cloud API 5 MB JPEG/PNG image-message cap.
-
Compress images for GitHub
GitHub Docs 10 MB cap for images and GIFs on issues and pull requests.
-
Compress images for Discord
Discord Support 20 MB free per-file upload cap.
-
Compress images for LinkedIn posts
LinkedIn Help 5 MB cap for share-box photo uploads.
-
Compress images for Instagram
Instagram Graph API 8 MB JPEG cap for feed, Story, and Reels cover.
-
Compress images for Twitter / X
X API 5 MB still-image cap for Posts and DMs (animated GIF 15 MB).
-
Compress images for Notion
Notion Help 5 MB cap for inline PNG/JPG display (all plans).
-
Compress images for WordPress
WordPress Media Library 2560 px big-image threshold and PHP upload_max_filesize limits.
-
Compress images for Facebook
Meta Help Center 15 MB photo uploads; keep PNG under 1 MB to avoid pixelation.
-
Compress images for Pinterest
Pinterest Help 20 MB web Image Pin max; BMP, JPEG, PNG, TIFF, WEBP.
-
Compress images for YouTube
YouTube Help custom thumbnails: 50 MB on desktop; 50 MB mobile video, 10 MB mobile podcasts; JPG or PNG.
-
Compress images for Threads
Threads API image posts: 8 MB max JPEG or PNG; width 320–1440 px, aspect ratio up to 10:1.
-
Compress images for Bluesky
Bluesky post embeds: 2 MB max per image blob (image/*); up to 4 images; alt text required.
-
Compress to KB tool
Set a KB target and download a file under budget.
All compress to kb guides
- Compress image to KB: hit a hard file-size limit
- Compress images for email: hit Gmail and Outlook attachment caps
- Compress images for WhatsApp: hit the 5 MB image message cap
- Compress images for GitHub: hit the 10 MB image and GIF cap
- Compress images for Discord: hit the 20 MB free upload cap
- Compress images for LinkedIn posts: hit the 5 MB photo share limit
- Compress images for Instagram: hit the 8 MB JPEG upload limit
- Compress images for Twitter / X: hit the 5 MB image upload limit
- Compress images for Notion: stay under the 5 MB inline limit
- Compress images for WordPress: Media Library size and big-image rules
- Compress images for Facebook: file size and format before upload
- Compress images for Pinterest: hit the 20 MB web Image Pin cap
- Compress images for YouTube: custom thumbnail file-size limits
- Compress images for Threads: hit the 8 MB image post limit
- Compress images for Bluesky: hit the 2 MB post embed limit
- Compress images for TikTok: hit the 20 MB photo upload limit
- Compress images for Shopify: hit the 20 MB and megapixel upload limits
- Compress images for Mastodon: hit the 16 MB post attachment limit
- Compress images for Slack: byte size and inline preview limits
- Compress images for eBay: hit the 12 MB listing photo limit
- Compress images for Etsy: stay under the 1 MB upload reliability tip
- Compress images for Medium: hit the 25 MB story-editor limit
- Compress images for Google Business Profile: fit 10 KB–5 MB photo rules
- Compress images for Wix: Media Manager limits and practical upload ceilings
- Compress images for Webflow: 4 MB Assets limits and upload prep
- Compress images for Squarespace: 20 MB cap and 500 KB performance recommendation
- Compress images for Ghost: Ghost(Pro) plan caps (5 MB–1 GB) and self-hosted 50 MB nginx default
- Compress images for Gumroad: 50 MB cover limit and thumbnail prep
- Compress images for beehiiv: 5 MB newsletter uploads, 1200×630 thumbnails, and 10 MB community posts
- Compress images for Mailchimp: 1 MB Content Studio uploads, 1024 KB targets, and legacy vs new builder widths
- Compress images for Kit: smaller-than-25 MB gallery, form/LP sizes, and email look-best width
- Compress images for Klaviyo: 10 MB email ceiling, 1024 KB load targets, form 5120 KB, and full-width dimensions
- Compress images for MailerLite: 10 MB File manager, 1024 KB campaign prep, GIF 4 MB, and width rules
- Compress images for Brevo: 5 MB Content library, layout widths, and HTML/attachment contrast
- Compress images for Substack: official sizes, PNG email banners, and dimension-first prep
- Compress images for Google Ads: 5120 KB JPG/PNG assets, aspect ratios, and surface-specific rows