Green coding - Cloudinary: Could a JPEG successor render greener?
This is a guest post for the Computer Weekly Developer Network (or CW Developer Network or Green Software Development) by Dr Jon Sneyers, senior image researcher at Cloudinary.
Sneyers argues that the hidden ecological cost of the trillions of digital pictures we take and store every year can’t be ignored – but could be usefully reduced by a shift to a more efficient storage format.
His full title for this piece is: The JPEG instigated digital image storage overload… could its successor curb the carbon impact?
Sneyers writes in full as follows…
Compared to wet film’s host of chemicals, digital imagery is by definition much more eco-friendly – if for no other reason than the fact these days we don’t even print on paper anymore. We mostly view the images we want on screens.
After all, in the first decade of the century, digital cameras completely overtook analogue cameras.
Writing this piece not long after Earth Day, it’s worth mentioning that while the ecological footprint per picture was reduced thanks to digital photography, the huge increase in the number of pictures we make causes the storage of those images to impact our planet more negatively than when we developed film in the early days using gelatin and silver halide crystals.
This year nearly 2 trillion new snaps will be taken on smartphones–adding to the estimated 10 trillion photos in digital storage.
A key solution here is better compression.
Digital images consist of pixels, typically organised in a rectangular grid and the advent of JPEG in 1992 made it easier to represent images in a way that ends up requiring only a few bits per pixel. This form of ‘lossy compression’ can produce images that are visually indistinguishable from the uncompressed image, but in only a tenth of the byte size previously needed.
The cost of convenience
So, we can (and do) take a lot of pictures… and they all end up being stored.
A typical size for a high-quality, high-resolution JPEG is 5 megabytes. That means that just the photos humanity will take in 2024 will require about 10 exabytes of storage – and the electricity required to store 10 exabytes for a year is at least 20 terawatt hours, which is equivalent to five million electric cars driving 20,000 kilometres each. As the well-worn cliché goes, “let that sink in”. In the bigger picture (no pun intended) of climate change, it may not be the biggest fish to fry, but the contribution of digital images to our global carbon footprint is definitely not negligible either.
But you see, that’s just the cost of storage.
Transferring photos over the Internet also comes at a cost which is almost certainly another five million cars driving 20,000 kilometres each, power-wise. It’s safe to say that digital photography has a significant environmental impact. The question is, what could we do to lessen it? Plus, websites have gotten richer and many feature video, which have their own associated storage and transfer power costs.
Finally, the ecological footprint of images and video is not only determined by storage and transfer, but also by the energy required to do encoding and decoding. Not all image formats are lightweight in terms of computational resources (and thus energy) required to encode or decode them.
This is in particular a problem for video codecs, where newer formats tend to require a lot more computing power.
A potential answer?
However, there is a way forward.
If we all started to use JPEG XL (think ‘to excel’, not Extra Large), storage and transfer costs for photos could both be reduced by 60% – cutting that ten million electric cars to four million.
This is because JPEG XL, introduced in 2022, genuinely offers 60% better compression than what stubbornly remains the digital image standard, JPEG. Even better, existing JPEG images can be converted to JPEG XL without any loss, but end up as 20% smaller files.
So far, no new format has managed to be as successful and ubiquitous as JPEG, and JPEG XL is not as yet widely accepted, with Google reversing early support two years ago. However, recently Apple announced support for JPEG XL across its ecosystem, which is certain to be a game changer.
Why let industry politics and inertia stop us? There are only three ways to reduce the immense (and still growing) digital image carbon footprint: making fewer pictures, reducing their quality, or using better image formats.
I know which option I prefer.
About the author
Sneyers was born and raised in Leuven, 30km to the east of Brussels and studied and worked at the University of Leuven, where he received a PhD in computer science. He co-created the Free Lossless Image Format (FLIF) and helped create key Cloudinary features like q_auto, f_auto, g_auto, e_improve, e_replace_color and e_cartoonify. He is also the chair of the JPEG XL ad hoc group within the JPEG committee and project leader of the corresponding ISO/IEC 18181 standard. He now works at Cloudinary researching anything related to image processing and image compression.