the Andrew Bailey


It turns out that programming takes a while. It's even longer when you don't program in C, so you barely have a clue of how to use a compiler. As soon as you add more than 10 megabytes of dependencies, I cry and run away. However, that isn't always the case.

The folks over at Mozilla have decided to use ubiquitous infrastructure better. Instead of implementing a next-gen image format like WebP or JpegXR, they're squeezing more efficiency out of JPEG. Last year, they started the MozJPEG project. Dig around a little bit, and you can see just what they are doing. It seems that version 3.0 is the greatest improvement yet. This is the first time that I've seen a JPEG encoder that doesn't totally destroy images with black on white text.

Screenshot of TabJpeg, optimizing the Fallout screenshot.

I managed to compile it, not just on Linux, but on Windows, too! I'm pretty sure that's a first. The problem is that even though it has binary compatibility with another JPEG library, no image editors that I use can use MozJPEG! So I found Emscripten, which is a C/C++ to JavaScript compiler. I whipped up an HTML GUI, but I was stuck at making the Emscripten output work. If I thought I didn't know C, this ended up being a nightmare. I cried and ran away to Java. I created a GUI in Netbeans, and figured out how to invoke other processes and use stdin and stdout with them. After some puzzling bugs, I got it. I've put the code on GitHub.

So please enjoy bigger and higher quality JPEGs on my blog. I've decided to either max out at 80kb per image, or JPEG quality 80. You're welcome.

Posted under Programming.

You can't complain about this anymore. It's perfect!