Developers, get 'image conscious' for royalty-free image codec JPEG XL
This is a guest post for the Computer Weekly Developer Network written by Dr. Jon Sneyers in his capacity as senior image researcher, Cloudinary.
Dr. Sneyers is the co-chair of JPEG XL adhoc group.
He invented the Free Lossless Image Format (FLIF) upon which JPEG XL is partly based. His image processing ‘Muscles from Brussels’ technology process helps deliver super-optimised images, super-fast.
JPEG XL is a new image codec conceived for delivering high-quality images on the modern web, notable for its high-fidelity compression and progressive rendering. The ‘bitstream freeze’ for the codec’s upcoming version, JPEG XL 0.2, is imminent. At that point, all past and future JPEG XL images will be compatible with future codec versions.
Sneyers writes as follows…
It was acceptable in the 90s
Today’s popular image formats – JPEG, GIF and PNG – were developed in the 80s and 90s when there was no mobile or app traffic, let alone responsive web design or 4K HDR screens. An update was long overdue.
A new image format battle is on.
Over the last decade, newer high-performance image formats like WebP, HEIF, AVIF and JPEG XL have been in the making that are better optimised for today’s digital experiences. I would like to suggest that this is why JPEG XL stands out.
First, let’s look at responsive design.
JPEG XL was designed specifically for images and does not derive from video codecs like WebP (based on VP8), HEIF (based on HEVC) or AVIF (based on AV1). As video codecs only offer sequential decoding, an image is not displayed until it has been fully loaded. Whereas JPEG XL progressively decodes images and shows a low-quality image preview, adding more detail as the data is loading. Also, it is no longer necessary to store variants of an image to serve different devices, browsers or network connections.
High Fidelity – High!
JPEG XL supports wide colour gamut as well as high dynamic range and high bit depth images. In contrast, image formats based on video codecs handle low bitrates very well, producing images that seem to look good at first glance. Upon closer inspection, they can appear ‘plasticy’. That’s fine for videos that show frames for less than 40 milliseconds, but images often require higher quality. JPEG XL’s efficient compression for high-end bitrates prevents the plasticy effects.
The JPEG XL reference encoder produces well-compressed images indistinguishable from the original. Other image formats use encoders that let you select a ‘quality’ setting (1-100) that is not defined perceptually. Consequently, one image might look fine as a quality-60 JPEG while another might still contain annoying artifacts as a quality-90 JPEG.
Across the universe to universality
JPEG XL includes features such as animation, alpha channels, layers, thumbnails, lossless and progressive coding to support a wide range of use cases. For new applications, it supports 360 degree images, image bursts, large panoramas/mosaics, and printing.
Unlike JPEG, it is designed for not just photographic but also non-photographic images (like illustrations, screenshots, game graphics, maps, etc). Developers can also use the format as a local storage and an exchange format for authoring workflows, for which fast and effective lossless compression and high bit depth are important.
How about legacy friendliness then?
JPEG XL includes several features to transition from JPEG images, still used by 72% of websites. This allows developers to reduce storage (servers can store a single JPEG XL file to serve both JPEG and JPEG XL clients) and file size (existing JPEG files can be losslessly transcoded to JPEG XL).
To transition from JPEG, other formats require images to be decoded to pixels and then re-encoded, leading to loss in quality.
Low computational complexity
JPEG XL is designed for computationally efficient encoding and decoding. It uses software implementations that don’t need additional hardware acceleration, even on mobile devices.
I encourage developers to try out JPEG XL but wait for large-scale adoption until the Final Draft International Standard is submitted in 2021.