If Google is obsessed with compression, you can count on the likes of Dropbox having a thing for it too. Driven by the need to store petabytes of user data in the most efficient way possible, the cloud storage company has come up with its own lossless JPEG compressor that can shave over 20 per cent off file sizes.
In a blog post entitled “Lepton image compression: saving 22% losslessly from images at 15MB/s”, Dropbox’s Daniel Reiter Horn goes into enormous detail about the company’s new “streaming image compression format”.
The article’s heading is a little misleading — Lepton doesn’t compress all images, just JPEGs — but that doesn’t take anything away from how nifty it is. It also isn’t a replacement for JPEG — it simply takes the image data, feeds it in an optimised way to an arithmetic encoder (in this case, the one from Google’s VP8 codec), which spits it out in an even more compact form.
The end result is that the JPEG images, which are already compressed pretty darn optimally, come out even smaller — 22 per cent on average — in Dropbox’s “Lepton” format. They can then be reconstructed back to JPEGs in bit-exact form.
As you may have guessed, the Lepton images are not compatible with normal JPEG decoders, but this back-and-forth is handled invisibly by Dropbox.
What makes Lepton particularly interesting is its performance — not only is it significantly reducing file size, it’s doing so at speeds fast enough for real-time purposes. Dropbox claims encoding and decoding rates of 5MB/s and 15MB/s respectively, with memory usage under 24MB.
For reference, a general-purpose compression algorithm such as LZMA can easily use hundreds of megabytes for compression, depending on threading and dictionary sizes.
The post mentions that Dropbox has already Lepton-encoded “16 billion images” and is “rapidly recoding … older images”. Right now the savings are in “multiple petabytes” and will only increase.
Dropbox has made Lepton open-source via the Apache license, so feel free to check it out on GitHub.