• 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).

1243Copy link
Comments9
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.
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
Сергѣй Юрьевичъ Соколовъ
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
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).
Login
  1. Bugs and Suggestions
AllIssuesSuggestions
by rating by time

14359 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
66221
Fixed
iOS badge counter shows unread messages, even 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
52207
Fixed
Incoming disappearing media with timer is blurry
Temporal media cannot be seen since it looks blurry for Android devices that receives it. Steps to reproduce 1. Receive a media with self-destruction timer in a cloud or secret chat. Current result Media…
Jun 20Issue, Android
133110
0:52
Fixed
Automatic saving of incoming photos doesn't work
Workaround Disable Automatic Media Download and manually download the images. Automatic saving of incoming photos doesn't work, after the February update (v 7.5) Sometimes random old photo from telegram…
Feb 24, 2021Issue, iOS
5361
Fixed
Missing parts of message history
Exact steps/settings are required to reproduce the issue Temporal workaround Use Clear Local Database in Data & Storage settings > Storage Usage Messages are missing on mobile but visible on Telegram…
Feb 15Issue, Android
2023
Added
Flag of Karakalpakstan Republic
Please add official flag of Karakalpakstan Republic into smiles. It's sovereign republic into Uzbekistan. You can find official flag here https://upload.wikimedia.org/wikipedia/commons/1/16/Flag_of_…
Dec 29, 2021ClosedSuggestion, Android
68012772
Added
Shadowsocks 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
894789
Added
Emoji reactions
An option to react to messages using small emoji (e.g.👍,❤️,👎) instead of replying in the chat with messages or stickers. Use Cases 1. Quick feedback that doesn't take up space in the message history.…
Nov 5, 2019FixedSuggestion
8192857
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
962841
Added
Silent sign up
A feature to join Telegram incognito, making the phone number privacy set to Nobody before creating a new account. Current users who have that number added to their contacts list will not get a new c…
Dec 12, 2019Suggestion
1191875
Added
Group Video Calls
Group Video Calls has been implemented in June 2021. Related suggestions: Group Video Calls with Contacts, Screen Sharing in private chats.
Dec 11, 2019FixedSuggestion, Calls
891640
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 20Android, Suggestion
21598
Added
Cryptocurrency donations for bots, groups and channels
Show a button for sending quick donations to maintainers of bots, groups or channels using cryptocurrency. This could use either an established cryptocurrency like Bitcoin, Etherium, EOS, etc. – or some…
Dec 25, 2020Suggestion, General
911567
Added
Screen sharing in calls
Screen sharing from mobile and desktop apps, in one-on-one calls and voice chats (also in group calls when they become available).
Dec 23, 2020FixedSuggestion
951504
Added
Choose a different default folder instead of "All Chats"
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 the back button would bring you back there when you're…
Nov 16, 2020Suggestion
611308
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
421258
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
151238
Added
In-app translator
Added In-app translator has been implemented in December 2021. Available on mobile apps from Settings > Language. Translating specific messages via the context menu like Twitter does for tweets. Use…
Nov 5, 2019FixedSuggestion
961212
Added
Live video streaming
A feature to share and experience live videos across groups and channels in Telegram. Broadcasting from a channel or your personal account (in group chats) so that others can view, react, and interact.
Dec 12, 2019FixediOS, Android, macOS, Telegram Desktop, Suggestion
791085
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
581067
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
931030
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, 2020Suggestion
52946
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
54876
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, 2020Suggestion, Telegram Desktop
29785
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, 2019Suggestion
715771
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
51721
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, 2021Suggestion, General
44713
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
14654
Added
Better global search
Make global search a place to find all communities in channels and public chats.
Feb 9, 2021Suggestion, Android
23651
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, 2020Suggestion, General
79618
Added
Call transfer between devices
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
17580
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
21571
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 26Suggestion, General
10565
Added
Different background images for each chat
A feature to set a individual wallpaper for specific chats. (f.e. One wallpaper for a specific group, another for a chat with a friend...) Use cases This would make navigation between chats easier, especially…
Nov 5, 2019Suggestion, General
38555
Added
Requests to join group or channel
If enabled, the user attempting to join the group/channel will only be able to view the content and send things after being accepted by an administrator (optional: only admins who have the "accept/decline…
Nov 23, 2020FixedSuggestion, General
156546
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
25533
Fixed
Telegram downloads images instead of using bitmap data from clipboard
When I paste an image copied from Firefox, Telegram downloads it again instead of using the bitmap data from the clipboard. This happens because the clipboard also stores the image URL. If I paste the…
Jun 27, 2021Issue, Telegram Desktop
5479
Added
Please Add a Clear Response button/ Retract response button in the Poll (Quiz mode) too for admins of the channel and subscribers of the channel
Hello Sir/Ma'am. I would like to draw the attention of the Telegram app to an important suggestion/request. I run telegram channels which consists of more than 50k+ Highly active students who solve quiz…
Feb 5Suggestion, Android
69461
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
102457
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. Mail app can be separated or it can simply be integrated inside the Telegram messenger…
Jan 24, 2021Suggestion, General
51444
Added
Syntax highlighting in code blocks
An optional extension to the backtick syntax to specify a language to highlight. Similar examples are the likes of Gitlab and GitHub comments.
Dec 27, 2020Suggestion, General
25429
0:12
Fixed
No popup appears when hitting floodwait limits for t.me links
When you hit floowait limits for t.me/ links, an endless loading animation appears, this may confuse users that could think about a connection issue. No issues on iOS, where a popup correctly appears.…
Feb 5, 2021Issue, Android
76411
Added
Change file names in Telegram
Option to change file name on Telegram without needing to re-upload the file. App: all
Dec 24, 2020Suggestion, General
19402
Added
Starred Messages
An option to bookmark/star a message. Marking a message would add it to the separate Starred Messages section on the profile page, for quick access to messages. While Telegram doesn't have Starred Messages…
Dec 12, 2019Suggestion
73398
Added
Remove or modify Telegram ad features
I really do wish that Telegram would reconsider putting up sponsored ads in channels. I've always kept it as my safe zone while the rest of the internet is saturated with ads. If the ads are going to…
Dec 9, 2021Suggestion, Android
60394
Added
Show folders when forwarding a message
An option to see your folders when sharing or forwarding messages. Use case Find the chats you were looking for more quickly. Workarounds - Use the search option to find the chat if it's not at the top.…
Nov 17, 2020Suggestion
7380
Added
Privacy settings for Bio
The Bio section in Telegram profiles is currently always public. Add an option to configure 'Who can see your bio?' to the Privacy and Security Settings. Use cases Putting more sensitive or private info…
Nov 5, 2019Suggestion
18370
Added
Way to mark messages as sensitive
An option to mark a message or photo as sensitive before sending. Sensitive messages can be revealed or re-hidden with a tap and default to hidden when a chat is opened. App: all
Dec 23, 2020Suggestion, General
10366
Added
Secret Chats on Telegram Desktop
An option to create Secret Chats using the multiplatform Telegram Desktop client.
Jan 5, 2021Suggestion, Telegram Desktop
32349
0:08
Fixed
Inline keyboard buttons become unresponsive when the menu is edited after tapping on a button
Workaround Rotate your phone and then tap on the desired button. Inline keyboard buttons become unresponsive with the new "menu transition" animation that appears when the menu is edited after tapping…
Dec 29, 2021FixedIssue, iOS
27349

Log In

Log in here to report bugs or suggest features. Please enter your phone number in the international format and we will send a confirmation message to your account via Telegram.

Cancel
(Incorrect?)

We've just sent you a message.
Please confirm access via Telegram

CancelBack