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.
We've just sent you a message.
Please confirm access via Telegram
Earlier with JPEG 2000, and with JPEG XR, and with JPEG XT the Joint Photographic Experts Group attempted to replace their old JPEG format. These three new formats gained some popularity when they appeared. Now two of them even have some (albeit limited) support in web browsers (JPEG 2000 in Safari, JPEG XR in Edge). However, those three formats could not ultimately replace JPEG.
JPEG XL image format (*.jxl file format), ISO/IEC 18181 standard, is the newest and the best replacement for the original JPEG format. It can prevail where the others failed: JPEG XL has an impressive set of attractive features.
First and foremost, old JPEG files can be losslessly converted to JPEG XL and back to JPEG. Such transcoded files are smaller in JPEG XL format (about 10% smaller for previously optimized JPEG files, about 20% smaller in general). This feature alone is a good attempt to bury the old JPEG. This feature alone is enough to warrant JPEG XL compression for JPEG images in Telegram because such images would be delivered faster and stored cheaper. (See my earlier suggestion https://bugs.telegram.org/c/1023 about that.)
Additionally, when a JPEG XL image is not a result of one such lossless transcoding of an old JPEG, then the following options (never available in the old JPEG format) become readily available:
① Pixels can be partially or entirely transparent where necessary.
② Wide gamut, and deep colours, and HDR images are supported.
③ Lossless compression is available, and it usually yields better results (smaller files) than the other well-known lossless image formats. (There is an exception: lossless WebP files containing screenshots of ClearType texts are sometimes smaller than their JPEG XL counterparts.)
④ Lossy compression is twice as good as the old JPEG. The new JPEG XL's quality-to-filesize ratio tends to be eclipsed only by AVIF files of equal size and only when files are significantly compressed (so that the number of bits-per-pixel is less than 1 on average, especially if less than 0.5). The images of higher fidelity (and higher bpp) are better compressed in JPEG XL.
⑤ The average colour values for the blocks of the lossy compression (8×8 pixels or larger) are stored earlier in the file and thus these values are the first to arrive from the Net and can be used to build a less detailed (and slightly blurry, because of the averaging) preview of the image while the rest of the file is still being downloaded. Even if such lossy JPEG XL is not a “progressive JPEG XL” per se.
⑥ On the other hand, incomplete downloads of “progressive JPEG XL” files can be used as smaller copies of the original image — half-width, quarter-width, and so on. Such copies are more exact (without averaging), but such “progressive JPEG XL” files are larger than their non-progressive counterparts. Such progressive JPEG XL files are useful when, for example, a QHD image (1440p) is requested less often than its HD (720p) and qHD (360p) versions, but the latter ones are a pain to create and to maintain separately (but they're nevertheless necessary when targeting the users of smartphones and smartwatches). Or when, for example, a 8K image (4320p) is requested less often than its 4K (2160p) and FullHD (1080p) versions, but the latter ones are a pain to create and to maintain separately (but they're nevertheless necessary when targeting the users on the most common levels of screen fidelity).
⑦ Progressive JPEG XL images can be made to contain (and thus to deliver) the most interesting (“salient”) areas of the image earlier in the file (see https://opensource.googleblog.com/2021/09/using-saliency-in-progressive-jpeg-xl-images.html for details).
⬇️ continued in the first comment ⬇️
⑨ Auxiliary channels are supported. They are useful when thermal imagery is to be stored alongside the regular photo, or when a depth map is available, etc.
The suggestion here is to support JPEG XL images absolutely everywhere in Telegram (in albums or single pictures, in stickers, in avatars, in thumbnailed uncompressed files, on Instant View pages, in preview areas under messages hyperlinked to external JPEG XL files or to JXL-featuring web pages, in preview areas under messages hyperlinked to other messages that contain JPEG XL, in uploads on Telegraph pages, in the results of external-URL-to-embed transformations on Telegraph pages, etc.), and to refrain from any automatic JXL-to-JXL recompression (see https://xkcd.com/1683/ for the rationale), and to refrain from imposing stricter limits (5 MB PNG are allowed on Telegraph pages → 5 MB JPEG XL should be allowed).
The implementation of this suggestion is expected to be delayed until the web browsers start supporting JPEG XL for real (right now their implementations are hidden behind flags in options, see https://caniuse.com/jpegxl for details, also see https://i.redd.it/s3l1g2b40jt61.png and https://i.imgur.com/ezQPsaW.png for the examples).
WebP and AVIF aren't better than JPEG XL.
They cannot compress old JPEG files losslessly (and thus they don't offer lossless decompression back to JPEG).
WebP does not support deep colors (only TrueColor). Chroma subsampling 4:2:0 is mandatory in lossy WebP files.
AVIF does not offer good lossless compression at all. Lossless WebP files are smaller than lossless JPEG XL only when a screenshot of ClearType text is compressed (an example of such screenshot is attached below).
Lossy WebP files are worse (in terms of quality-to-filesize ratio) than either AVIF or JPEG XL. Lossy AVIF files can be better than lossy JPEG XL files when both are compressed below 1 bit per average pixel (especially below 0.5 bpp), worse otherwise.
WebP files cannot be displayed progressively (only top-to-bottom). AVIF files currently do not offer even top-to-bottom progression and thus they have to be entirely delivered before they are displayed. (Future AVIF encoders and decoders may offer several layers of progression.) Lossy JPEG XL files are always progressive.