
Using Mozjpeg to Create Efficient JPEGs - rnyman
https://hacks.mozilla.org/2014/08/using-mozjpeg-to-create-efficient-jpegs/
======
Daemon404
I am waiting until 3.0 when they roll out their plan for ABI compatibility (it
currently masquerades as jpeg62 but is not compatible), and decide on a
defacto way to detect if you are building against vanilla libjpeg(-turbo) or
mozjpeg (currently you can check for some of their struct members, but they
have not stated if they will be going away or not when ABI compatibility is
addressed).

At that point I plan to submit a patch to ImageMagick to detect it and enable
the user options if mozjpeg is being used. I believe downstream support in
libraries like ImageMagick is key to adoption, rather than adding makeup to a
pig (input support for N formats in cjpeg).

~~~
rnyman
Robert at Mozilla here. I'd love to talk more, how do I best reach you? Or you
can e-mail me at firstname [at] mozilla [dot] com

~~~
Daemon404
Hey, I'm 'Daemon404' on FreeNode and Mozilla IRC, or you can grab my FOSS
email from my GitHub account or FFmpeg/Libav's git repo.

~~~
rnyman
Thanks, emailed

------
pdknsk
It's interesting that Mozilla has chosen to use an image with so much red,
which makes JPEG (at their settings) look relatively poor even at quality 100.
You cannot optimise the limitations of 2x2 chroma subsampling.

I am also not convinced by Trellis yet. In my tests, it introduced a faint
blur. In fairness though, I only tried 4:4:4 and not 4:2:0 as Mozilla
apparently does. In the latter case, additional blur may not be noticeable.

~~~
Daemon404
You can 'optimize' encode-time by using better chroma downsampling, but really
the issue is usually on the client side upsampling (a lot of libs use terrible
nearest neighbor for 'speed').

As for trellis, you should play with the different metrics available (MS-SSIM
etc), but I agree I have not been wowed yet.

~~~
pdknsk
Yes, optimise is the wrong word. I meant optimise away really, but that's
still not quite right. The WebP authors are actually working on improving
chroma subsampling, because VP8 limits WebP to 2x2.

~~~
Daemon404
mozjpeg has such a bug opened too:
[https://github.com/mozilla/mozjpeg/issues/8](https://github.com/mozilla/mozjpeg/issues/8)

This isn't exactly new ground beign covered here, nor is it tied to one image
format, so I wish people would be a little less NIH-y sometimes...

------
kraken-io
If you'd like to test how the latest Mozjpeg performs check us out at
[https://kraken.io/web-interface](https://kraken.io/web-interface) and choose
"lossless".

------
putlake
I'd love to be able to use jpegoptim or mozjpeg but the trouble is choosing
the right quality level. As Steve Souders says in his comment on TFA, it's not
possible to experiment with varying quality levels when you have hundreds of
images to optimize.

Because we haven't been able to solve that problem yet, we use JPEGmini, a
proprietary (but not that expensive) vendor solution.

~~~
Daemon404
You ought to take a look at jpeg-archive:
[https://github.com/danielgtaylor/jpeg-
archive](https://github.com/danielgtaylor/jpeg-archive) (the bbcq-like is
similar to jpegmini's weighting).

------
toisanji
We've already implemented this in [http://filepicker.io](http://filepicker.io)
so you don't need to do anything if you are already on the service.

------
jvickers
Any chance of Mozilla releasing a node.js plugin that wraps the library?

I'd also be really interested in an ASM compiled version that's easy to use
from node (and possibly the browser).

------
maerek
Anyone have more details on exactly what cjpeg does? What sets this apart from
a solution like JPEGoptim?

~~~
sp332
Mozilla recently improved the JPEG encoder. They claim 5% smaller files then
libjpeg-turbo.
[https://news.ycombinator.com/item?id=8036959](https://news.ycombinator.com/item?id=8036959)

------
niutech
How does mozJPEG compare with WebP in terms of size with the same quality?

------
WhitneyLand
Hate progressive jpegs. Always sit there and squint for a second with Google
images till a second later when hi-res pops-in. Just let it render and I'll
take the 4% efficiency hit.

~~~
ominous_prime
You can use progressive jpegs without progressive rendering. Google images
isn't even using this, they are displaying a very low-res photo immediately,
and loading a higher quality one in the background.

(and FYI, most sites that optimize their images (e.g. Facebook) use
progressive jpegs for efficiency).

------
sxates
Just what your designer always wanted - a command line tool to create jpegs!

~~~
mkonecny
The designer will usually provide very high quality PNG's/PSD's. It's up to
the developers to scale it down to the optimal size for each device.

