• Copy Link
Stop server-side JPEG-to-JPEG recompression
Сергѣй Юрьевичъ Соколовъ, Jan 24, 2021 at 06:32
OpenSuggestionGeneral

A contributor to Telegram Desktop has once said at https://github.com/telegramdesktop/tdesktop/issues/5317#issuecomment-502341782 that it's not useful to raise the quality of JPEG photoes compressed by client-side applications because “the server itself compresses the photos” and “most of the compression is performed by the server”.

Hence the suggestion that is very simple: Telegram should stop performing server-side JPEG-to-JPEG recompression because such recompression has several important demerits.

Server-side JPEG-to-JPEG recompression makes it nonsensical to improve client-side JPEG compression. Telegram Desktop's decision to use MozJPEG (see https://github.com/telegramdesktop/tdesktop/pull/8787 for details) and the same (earlier) decision of Telegram for iOS (see https://github.com/TelegramMessenger/Telegram-iOS/commit/e1432e41711f5b114e338e81522ad73a3f4f5645 for details) does not mean much if the server then uses some visibly worse JPEG encoder that cannot even generate progressive JPEG (see https://t.me/kepka_support/15058 for details).

Server-side JPEG-to-JPEG recompression results in generation loss (see https://en.wikipedia.org/wiki/Generation_loss for the definition). The most popular pictures (the pictures that are saved and sent again the most often: the memes, the spectacular photoes, the screenshots of awesome news, etc.) are the most “punished” by the quality loss.

Server-side JPEG-to-JPEG recompression is likely to incentivize unofficial clients to create JPEG files of exorbitant quality (when compressing PNG-to-JPEG, for example) and thus to lengthen the delivery in order to ensure that the only quality loss is server-side.

Server-side JPEG-to-JPEG recompression is costly. It involves the expenditure of the precious server-side CPU cycles (and these are so precious that Telegram intentionally refrains from GIF-to-MP4 recompression of files greater than 10 megabytes despite the larger filesize-related gains for them). In addition to that, and perhaps more importantly, server-side JPEG-to-JPEG recompression also generates (because of the generation loss) many files containing the same image on different stages of recompression and thus the expenditure of server-side storage for all of these files.

Telegram should get rid of all that demerits: Telegram should rely solely on client-side JPEG compression. The only server-side JPEG processing should be simple (not CPU-intensive) tasks such as removing of geotags (for the sake of better privacy) and trimming the files' tails (to prevent any RARJPEG) and the inevitable check of images' parameters to enforce the simple set of rules that are imposed on client-side JPEG compression; and these rules should be made public.

For example, compressed images in Telegram cannot exceed 1280×1280 pixels, and thus server should reject client-sent JPEG images wider or higher than this limit with an error (instead of attempting to recompress).

For example, Telegram servers can reject large JPEG files with an error if the file is larger than, say, one or two megabytes.

For example, Telegram servers can reject JPEG files based on their bytes-to-pixels ratio, requiring no more than 6 or 7 bits (of the encoded files) per pixel on average (not to be confused with https://en.wikipedia.org/wiki/8-bit_color of the decoded images).

2264Copy link
Comments11
Show 1 more comment
Сергѣй Юрьевичъ Соколовъ Jan 24, 2021
Client-side applications can afford being better at JPEG compression than Telegram servers. Telegram users, however, can go even further if necessary. A typical Telegram client can only try one default setting of JPEG compression (and then maybe two or three backup settings) because it's inclined to send its results faster. And when Telegram users (such as digital artists or authors of some photo documentary) are ready to try many more compression settings for the sake of better-looking images in their Telegram channels (and when they spend much more time than the usual user can tolerate before an image is sent; ten minutes, for example), that's exactly when they are able to reach somewhat better JPEG quality within the same public set of constraints. They could find and try some experimental luma-controlled method of color subsampling (such as https://github.com/kornelski/jpeg-compressor#subsampling for example) that any Telegram developer could not know about or could not implement; and their resulting JPEG files would still be accepted and published in Telegram if the current server-side JPEG-to-JPEG recompression is stopped and abolished.
Сергѣй Юрьевичъ Соколовъ Jan 24, 2021
It is important to keep in mind that engineers in Twitter are one year ahead in understanding the benefits of incentivizing user-side compression efforts: Twitter allows any JPEG to be posted through their Web site “almost as is” (without server-side JPEG-to-JPEG recompression; nevertheless, any geotags are removed for the sake of better privacy) if that JPEG does not exceed 4096×4096 pixels, and does not exceed 5 megabytes, and does not spend more than 8 bits on an average pixel (since January 2020, see https://twittercommunity.com/t/upcoming-changes-to-png-image-support/118695 for details). Telegram might decide to follow that example not only because the practice seems rational, but also because that's exactly what is habitual for many millions of “digital refugees from Twitter” that are coming to Telegram.
Сергѣй Юрьевичъ Соколовъ Jan 24, 2021
Likewise, Telegraph (the site, not the Graph Messenger) should also stop its own server-side JPEG-to-JPEG recompression. Telegraph should keep uploaded JPEG files “as is” (like it keeps uploaded PNG files already) and only impose the usual Telegraph's limit on filesizes (5 megabytes).

Telegram Desktop should also refrain from further client-side JPEG-to-JPEG recompression when its users save JPEG files. Any saved JPEG files should be saved exacty as they were received.
S
Serhii Popov ️ Jun 18, 2021
You can send jpgs without recompression in Telegram already. Select pictures, tap three dots menu and select "Send without compression".
But I think it's a nice default to rescale and recompress images so they don't take much space.
Сергѣй Юрьевичъ Соколовъ Jun 18, 2021
Serhii Popov ️
You can send jpgs without recompression in Telegram already. Select pictures, tap three dots menu and select "Send without compression". But I think it's a nice default to rescale and recompress images so they don't take much space.
A common case is that the picture, if passed through Telegram channels, has already been recompressed twice or thrice: once when sent, once again on the server side, maybe once again if saved from Telegram Desktop. If you need to repost that picture, can you decide that it's not compressed enough (despite all the previous attempts to compress it) and justify its further recompression by the argument “so it doesn't take much space”? — also that argument may already be invalid if Telegram uses some single-instance storage (see https://en.wikipedia.org/wiki/Single-instance_storage for the definition) and an exact copy of the file is much cheaper than the recompressed version.
Khaled [E] Dec 11, 2021
Maybe offer conversion options in the client. Like video quality options for videos.
Сергѣй Юрьевичъ Соколовъ Mar 9, 2022
Сергѣй Юрьевичъ Соколовъ
Likewise, Telegraph (the site, not the Graph Messenger) should also stop its own server-side JPEG-to-JPEG recompression. Telegraph should keep uploaded JPEG files “as is” (like it keeps uploaded PNG files already) and only impose the usual Telegraph's limit on filesizes (5 megabytes). Telegram Desktop should also refrain from further client-side JPEG-to-JPEG recompression when its users save JPEG files. Any saved JPEG files should be saved exacty as they were received.
A fix for one of the aforementioned issues (“Telegram Desktop should also refrain from further client-side JPEG-to-JPEG recompression when its users save JPEG files”) is delivered in Telegram Desktop 3.5.6 beta.

Its changelog at https://github.com/telegramdesktop/tdesktop/releases/tag/v3.5.6 says “Always try to save original photo bytes to disk”.
Сергѣй Юрьевичъ Соколовъ Apr 30, 2022
A further improvement is delivered in Telegram Desktop version 3.6.0 (see https://github.com/telegramdesktop/tdesktop/commit/6805259f74a163ea851fee0e1ae743e81bf75c61 for details).

Telegram Desktop no longer recompresses a JPEG file before sending if the following four rules are obeyed by that JPEG:

① JPEG format is progressive,

② JPEG's width is 1280 pixels or less,

③ JPEG's height is 1280 pixels or less,

④ JPEG's filesize is 4 bits (or less) per average pixel.

Such JPEG files are nevertheless recompressed (JPEG-to-JPEG), but only once (on the server side).
Dev stuido Feb 16
https://t.me/devstudilabss
S
Seak Leang Apr 26
Stop server-side JPEG-to-JPEG recompression #1058
Login
  1. Bugs and Suggestions
AllIssuesSuggestions
by rating by time

40232 Cards

Added
About this platform
All users are welcome to create new entries, view existing entries and vote on them. What is this for? This platform is a place where users can vote for feature suggestions for Telegram or report issues…
Dec 23, 2020ClosedTip
88
Added
Disable "New Contact Joined" chats
Users receive a notification when one of their contacts becomes available on Telegram. It is currently possible to disable the notification: the new chats will appear in the list without sending a notification.…
Dec 11, 2019Suggestion, General
93
Added
Allow site owners to make their own Instant View templates
Instant View templates are currently created and maintained by Telegram, the list of supported websites is expanded gradually. Some site owners would like to get IV support for their websites sooner.…
Jan 23, 2021Suggestion, General
62
Added
Hide messages from blocked users in groups
Sometimes you don't want to see messages from people you blocked, even in the groups you share with them. Such messages could be automatically collapsed and hidden under a spoiler (like 'You blocked Doge.…
Nov 5, 2019Suggestion, General
199
Added
Call transfer between devices
Add an option to seamlessly transfer ongoing voice and video calls between different devices with one account: e.g., from a mobile phone to a desktop PC and vice versa.
Dec 23, 2020Suggestion, General, Calls
34
Added
Separate passcode lock for specific chats or Archive
Option to lock certain chats with a separate passcode. On a chat-by-chat basis, or for an entire Chat Folder, e.g. the Archive. Use cases Family iPads and other shared devices. Can also be used in environments…
Nov 5, 2019Suggestion, General
59
Added
Secret Group Chats
Add an option to create Group Chats with End to End Encryption like Secret Chats.
Jan 28, 2021Suggestion, General
53
Added
Bookmarks in channels
A feature to mark a message in a channel, and to continue reading the channel from this message. Use cases Long stories, broadcasts, and 'I will read it later' situations. Workaround Forwarding a message…
Nov 5, 2019Suggestion, General
19
Added
Feed or Stream with posts from Subscribed Channels
Show posts from channels you're subsribed to in a single view, one post after another – without the need to open each channel seprately to see what's new. Like Twitter and other feed-based social networks.…
Dec 23, 2020Suggestion, General
50
Added
Standalone watchOS app
An independent Watch app that allows the user to receive messages and reply to them even when their paired iPhone is out of range.
Dec 12, 2019FixediOS, Suggestion
32
Added
LaTeX support to write math equations and formulas directly in the message
Add the inline LaTeX support to include math formulas and symbols directly in the message. Engineers would love this feature!
May 9, 2021FixedSuggestion, General
4
Fixed
New sticker/emoji search doesn’t prioritize saved stickers/emoji
Now sticker lookup and sticker pack lookup is completely broken. For example before if I looked up "smile" it would pull results from my saved packs first and all of the random default unsaved packs last.…
May 7FixedIssue, Android
19
Added
Dedicated wearOS app
Create a dedicated and update wearOS app for Telegram that allows users to communicate with users like the smartphone version, with support for media and cellular data on the smartwatch.
Mar 21, 2021FixedSuggestion, Android
4
Fixed
Media shared via external share cannot be sent as file
Description When trying to send a media file (photo or video) from the phone's gallery to Telegram via the standard system "Share" button, the option to "Send as file" is not working correctly. Steps…
May 28Issue, Android
4
0:18
Fixed
In version 12.8.0, the 'mark as read' option from the dropdown menu is not working
In version 12.8.0, the ‘mark as read’ option in the drop-down menu does not work. Steps to reproduce 1. You receive a message whilst on the home screen 2. You try to tap “mark as read” to indicate that…
Jun 9FixedIssue, Android
5
Fixed
Persistent media playback notification after listening to voice messages
After updating to Telegram 12.8.0 on Android, the media playback notification stays stuck after listening to a voice message. It disappears only if I fully close Telegram from recent apps. I tested the…
Jun 11Issue, Android
10
Added
Option to disable the Stories feature
Official Response: Stories take up no extra space in the Telegram UI – but if you'd prefer not to see stories from certain contacts, hold down on their profile picture at the top of your screen and select…
Jul 21, 2023Suggestion, General
16087925
Added
Shadowsocks proxy support
Add Built-in VMess, Shadowsocks, SSR, Trojan-GFW proxies support The ( vmess / vmess1 / ss / ssr / trojan ) proxy link in the message can be clicked
Apr 11, 2021Suggestion, General
1417571
Added
Improve the ability to search chat history for Asian regional languages, such as Chinese and Japanese
Improve the ability to search chat history for Asian regional languages, such as Chinese and Japanese. Telegram's chat history search function is based on words, and is suitable for languages such as…
Dec 23, 2020Suggestion, General
2403796
Added
The sticker text is covered of the time of the message
The time of the message is displayed on the sticker. It is not comfortable to read sticker. It often happens that time covers part of the text on the sticker. And if the sticker is sent from the channel…
Mar 20, 2022Android, Suggestion
222639
Added
Update Iran Flag Emoji to Sun & Lion
PSA: کاربران گرامی دقت داشته باشید که نیاز به ارسال کامنت‌های اسپم در این پیشنهاد نیست و لایک کردن پیشنهاد کافیست این اقدام هم‌وطنان که به صورت گروهی در حال اسپم کردن بخش پشتیبانی و پلتفرم پیشنهادهای…
Jan 9FixedSuggestion, General
252124
1:52
Added
Emergency passcode to hide chats
Option to set an alternative passcode ("double bottom") that either opens a limited set of chats, opens a different account, or destroys one of the connected accounts completely when entered. Use cases…
Feb 27, 2021Suggestion
932015
Added
Notify all group members
An option to notify all group members or admins using a special mention (e.g. @all and @admins). Use cases Important news and major updates in big communities. Potential issues Some group admins already…
Nov 4, 2019Suggestion
1481789
Added
Chat permissions: Can Talk
Please add chat permission: Can Talk. How it works If it's enabled, user can talk in a voice chat. Otherwise user is muted. For users In apps it would be useful for chat owners - they will be able to…
Aug 3, 2021Suggestion, General
241772
Fixed
App's badge counter shows unread messages when all chats are read
Badge counters inside the app and on the app's icon may sometimes show unread messages while there are no unread chats in the list. Workaround Tap 10 times on the Settings tab icon > Reindex Unread Counters.…
Nov 12, 2020Issue, iOS
6181507
Added
Unlimited favorite stickers
Increase the limit for favorite stickers. The current limit is five stickers. When you add another one, the first sticker is replaced. Use cases Choose a limited set of stickers which you will always…
Dec 11, 2019Suggestion
741505
Added
Choose a different default folder instead of "All Chats"
This feature is available as part of Telegram Premium. An option to pin one of your folders as the main folder instead of All Chats. When you open the app, it would show you the folder you chose. Pressing…
Nov 16, 2020FixedSuggestion
701467
Fixed
Live streams have low speed audio resulting in almost no sound
Since the latest stable update, audio from Live Streams is missing. The audio track is actually slightly audible if you max out the volume of your device, but it will be barely noticeable, and feels extremely…
Jan 4, 2025FixedIssue, iOS
61372
Added
Partial reply
Reply only on parts of a message. This would be very useful, if someone wrote a very long message and you only want to refer to one or two sentences - or even only one or a few words.  If you click on…
Jan 23, 2021FixedSuggestion, General
711363
Added
Allow adding Bots (Web Apps) to the Attachment Menu to all bots
Now only selected bots can be added to the Attachment Menu. But as a developer of inline bots, I see this as a barrier to make telegram a better messenger Let users decide, what they want to see in their…
Apr 17, 2022Suggestion, General
191273
Fixed
Telegram's Message Limit: Old Messages Gone Forever
When the message count reaches a million, old messages disappear. Steps to reproduce 1. Be an active Telegram user 2. Wait until the coveted number of incoming/outgoing messages is reached. 3. Eh, it's…
Jul 19, 2022Issue, General
1001231
Added
Disable iOS design in Android app
Android app should follow Material Design, not iOS patterns The recent Android update (12.4.*) introduces design elements directly ported from iOS, creating a non-native experience that ignores platform…
Feb 7Suggestion, Android
4101171
Fixed
Incorrect Search Ban for Quality channels
Incorrect Search Ban on one of The Largest Telegram Channel Steps to reproduce My Channel @Funny is one of the largest English Entertainment channel with Over 250K Subscribers & great Engagement. But…
Dec 15, 2024Issue, General
451143
Added
Alternate profile pictures
When setting a profile picture or video that's only visible to contacts (or certain users, groups etc.), allow choosing an alternate picture or video that will be shown to everyone else. Use cases -…
Nov 17, 2020FixedSuggestion
641131
Added
Armenian language official translation in telegram
Dear Telegram administration. We ask you to make the translation of the Armenian language official in telegram. Not a few people speak Armenian, and a full-fledged Armenian segment has already formed…
Jan 8, 2023Suggestion, General
2081080
Added
Better global search
Make global search a place to find all communities in channels and public chats.
Feb 9, 2021Suggestion, Android
541045
Added
Add Instant View to Telegram Desktop
Add Instant View to Telegram Desktop. The feature is there right now for MacOS Telegram App, but missing from regular Telegram Desktop. Preferably, it should open an article in the existing telegram window…
Dec 23, 2020FixedSuggestion, Telegram Desktop
691039
Added
Transfer ownership if creator account was deleted
Option to transfer ownership in groups and channels if the creator was deleted so the first admin with all permissions will become a creator! Thumbs up if you want this to happen 👍 App: all
Dec 24, 2020FixedSuggestion, General
1651005
Added
NTF Stickers
Dear Telegram Team, This is a proposal to enhance the Telegram ecosystem: the introduction of NFT stickers — unique digital stickers based on blockchain technology, which can not only be used in chats…
Oct 10, 2025Suggestion, General
57975
Added
No one open the video in the groups conversations without the admins permission
During the meeting conversations in telegram, some members want to speak so when we open the Microphone for them to speak, they open video with sexual content. This leads to annoy the members and they…
Jan 30, 2023Android, Suggestion
24967
Fixed
Status displaying issue for iranian numbers
Title: Unreasonable Restrictions on Iranian Accounts Description: Viewing Premium Statuses: Non-premium Iranian accounts cannot see the statuses of premium users. However, purchasing a premium subscription…
Oct 26, 2024FixedIssue, Android
88943
Added
Proper support for inline video messages fro bots
Proper support for Video Notes (aka round videos) in inline mode for bots
Nov 9, 2022Suggestion, General
67926
Added
Add an option to disable auto-ordering of sticker packs on mobile
Add an option to disable auto-ordering of sticker packs. If you have a lot of packs, it make sense to order them in a way that makes it easy for you to find the right sticker. This has been the behaviour…
Sep 19, 2022FixedSuggestion, Android, iOS
223884
Added
Custom icons for folders
Add the ability to choose icons for folders on mobile platforms – like in Telegram Desktop and Telegram macOS. Sync them on all devices. Use cases - Find folders you're looking for more easily. - Save…
Nov 17, 2020Suggestion, iOS, Android
28872
Added
More Two-Factor Authentication methods
An option to add an authenticator app with temporary, one-time passwords (e.g. Authy, Google Authenticator) as another second factor.
Nov 5, 2019Suggestion
33831
Added
An option for a channel/group owner to better interact with subscribers without the risk of being reported as spammer by trolls.
An option for the owner of a channel or a group to set a visible flag informing all new members that they might be privately contacted one single time by the owner/admins of the channel/group they are…
Feb 26, 2022Suggestion, General
41780
Added
Tmail - Telegram Email Service
Telegram is a great messenger, but it can also be a great Email service. So without further introductions, let's start. It may seem like Email service is for the previous generation, but many people,…
Jan 24, 2021Suggestion, General
126748
Fixed
Missing parts of message history
Your help needed: The team needs help with app's logs. Messages are missing on mobile but visible on Telegram Web and Desktop. Notifications of new messages are received, but messages don't appear in…
Feb 15, 2022Issue, Android
82741
Added
Stories / Statuses
An option to share moments (media, like photos or short videos, texts, etc.) with your mutual contacts (this can be adapted with granular privacy permissions) to view, interact, and forward. Such statuses…
Dec 12, 2019FixedSuggestion
973713
Added
Option to disable AI icon in text input field required
Add the Option to disable the AI Pop Up / Remove AI features. As disturbing AS the Implementation of AI into Messengers is. We need to be able to choose! And many people might just click on the pop-up…
Apr 1Suggestion, General
348712