Most comprehensive write up of JPEG et al. I have ever come across.
I think the MozJPEG compression optimisations deserves a mention, as does where we started, with RLE encoding for printer things.
Also important for my personal understanding of JPEG is the context: slow CPUs and analogue screens. OG JPEG was optimised for this, MozJPEG changed the look up tables and the ubiquitous 'turbo' JPEG library to use a few more CPU cycles and save a few more bytes, whilst fixing the banding that was actually okay in the analogue days of old CRT monitors.
I recently built a small image optimizer for macOS since ImageOptim is mostly abandonware now. Specifically for folks who dislike complex build tools for this job https://shiboru.com
Worth highlighting the QOI Image format (qoiformat.org) showing that you can also get significant image compression benefits with a simple 1-page specification [1]:
> QOI is fast. It losslessly compresses images to a similar size of PNG, while offering 20x-50x faster encoding and 3x-4x faster decoding.
> QOI is simple. The reference en-/decoder fits in about 300 lines of C. The file format specification is a single page PDF.
Don't sleep on JPEG XL. It's used under the hood within DNG files (at least, it's an option, Adobe DNG Converter can leverage it, including by the CLI), DxO PureRAW leverages it in the latest versions. Apple Photos can view them, and I think it's been the compression methodology used inside their ProRAW DNGs for a while (which probably by default makes it one of the worlds most popular image compressors for RAW files). I've had a lot of success using it for various things. Had some issues surrounding metadata but that may be user error on my part.
JXL is great on a variety of images with great PSNR across the board. Surprised it took browsers a good long time to ship it (removed and brought it back)
You can get way better perceptual compression at much much tinier sizes though. This is where a lot of user studies and research could play out.
If you've read that article out, you might want to take a look at alternative approaches to compressing images with similar principles.
https://github.com/guilt/MLL is a recent reimplementation of an old idea; If you quantize out the image blocks you could emit them in vector coordinates and have perceptually similar results at a fraction of the size with very decent signal preservation.
> Now that WebP is widely supported by browsers and operating systems, there's really no downside to using it. It's much more flexible than JPEG or PNG and offers better compression than both of them.
I'd probably skip WebP, and go straight to AVIF at this point. I believe all modern browsers support it, and it compresses better than WebP.
> More so than any other image format, JPEG takes advantage of the quirks of human perception to throw away information while largely preserving quality.
That is a very odd thing to say in a post that also mentions WebP. I would say that of all the commonly supported lossy image codecs released since 1992, JPEG takes the least advantage of human perception quirks.
13 comments
[ 3.3 ms ] story [ 37.3 ms ] threadIt's amazing to me how we much we can fill in the blanks to make something recognizable with such little data.
I think the MozJPEG compression optimisations deserves a mention, as does where we started, with RLE encoding for printer things.
Also important for my personal understanding of JPEG is the context: slow CPUs and analogue screens. OG JPEG was optimised for this, MozJPEG changed the look up tables and the ubiquitous 'turbo' JPEG library to use a few more CPU cycles and save a few more bytes, whilst fixing the banding that was actually okay in the analogue days of old CRT monitors.
Bookmarked the article for re-reading.
> QOI is fast. It losslessly compresses images to a similar size of PNG, while offering 20x-50x faster encoding and 3x-4x faster decoding.
> QOI is simple. The reference en-/decoder fits in about 300 lines of C. The file format specification is a single page PDF.
[1] https://qoiformat.org/qoi-specification.pdf
You can get way better perceptual compression at much much tinier sizes though. This is where a lot of user studies and research could play out.
If you've read that article out, you might want to take a look at alternative approaches to compressing images with similar principles.
https://github.com/guilt/MLL is a recent reimplementation of an old idea; If you quantize out the image blocks you could emit them in vector coordinates and have perceptually similar results at a fraction of the size with very decent signal preservation.
I'd probably skip WebP, and go straight to AVIF at this point. I believe all modern browsers support it, and it compresses better than WebP.
That is a very odd thing to say in a post that also mentions WebP. I would say that of all the commonly supported lossy image codecs released since 1992, JPEG takes the least advantage of human perception quirks.