News for hackers. Stuff that matters.
Re:Using Mozjpeg to Create Efficient JPEGs by Daemon404 on Wednesday August 06, 2014 @02:12PM (#8143944)
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).

Re:Using Mozjpeg to Create Efficient JPEGs by rnyman on Thursday August 07, 2014 @06:26AM (#8146979)
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
Re:Using Mozjpeg to Create Efficient JPEGs by Daemon404 on Thursday August 07, 2014 @12:13PM (#8148489)
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.
Re:Using Mozjpeg to Create Efficient JPEGs by rnyman on Thursday August 07, 2014 @12:38PM (#8148653)
Thanks, emailed
Re:Using Mozjpeg to Create Efficient JPEGs by pdknsk on Wednesday August 06, 2014 @01:49PM (#8143799)
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.

Re:Using Mozjpeg to Create Efficient JPEGs by Daemon404 on Wednesday August 06, 2014 @02:07PM (#8143913)
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.

Re:Using Mozjpeg to Create Efficient JPEGs by pdknsk on Wednesday August 06, 2014 @02:37PM (#8144066)
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.
Re:Using Mozjpeg to Create Efficient JPEGs by Daemon404 on Wednesday August 06, 2014 @02:43PM (#8144112)
mozjpeg has such a bug opened too: 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...

Re:Using Mozjpeg to Create Efficient JPEGs by putlake on Wednesday August 06, 2014 @02:30PM (#8144036)
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.

Re:Using Mozjpeg to Create Efficient JPEGs by Daemon404 on Wednesday August 06, 2014 @02:36PM (#8144062)
You ought to take a look at jpeg-archive: https://github.com/danielgtaylor/jpeg-archive (the bbcq-like is similar to jpegmini's weighting).
Re:Using Mozjpeg to Create Efficient JPEGs by kraken-io on Wednesday August 06, 2014 @01:08PM (#8143501)
If you'd like to test how the latest Mozjpeg performs check us out at https://kraken.io/web-interface and choose "lossless".
Re:Using Mozjpeg to Create Efficient JPEGs by toisanji on Wednesday August 06, 2014 @01:42PM (#8143741)
We've already implemented this in http://filepicker.io so you don't need to do anything if you are already on the service.
Re:Using Mozjpeg to Create Efficient JPEGs by jvickers on Wednesday August 06, 2014 @01:24PM (#8143615)
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).

Re:Using Mozjpeg to Create Efficient JPEGs by maerek on Wednesday August 06, 2014 @12:10PM (#8143202)
Anyone have more details on exactly what cjpeg does? What sets this apart from a solution like JPEGoptim?
Re:Using Mozjpeg to Create Efficient JPEGs by sp332 on Wednesday August 06, 2014 @12:12PM (#8143213)
Mozilla recently improved the JPEG encoder. They claim 5% smaller files then libjpeg-turbo. https://news.ycombinator.com/item?id=8036959
Re:Using Mozjpeg to Create Efficient JPEGs by pornel on Wednesday August 06, 2014 @01:29PM (#8143648)
jpegoptim optimizes Huffman tables. Mozjpeg's cjpeg always does it, plus:

* jpegcrush/jpegrescan trick: tweaks details of progressive JPEG for maximum compression (each scan gets its own Huffman table, and JPEG can arbitrarily divide data into scans). That's 5%-10% improvement over jpegoptim.

* if you're creating a new JPEG or lowering quality of an existing one, then it uses trellis quantization. In the lossy compression step instead of naively throwing away data, it evaluates lots of combinations to find best bang-for-the-buck combination. That's an extra 5% improvement in quality/filesize ratio.

Re:Using Mozjpeg to Create Efficient JPEGs by joshmoz on Wednesday August 06, 2014 @01:05PM (#8143476)
"cjpeg" is the basic command-line tool for making use of the mozjpeg library to create JPEG images.

libjpeg-turbo and IJG JPEG libraries also have "cjpeg" tools as their basic command-line encoder. The tool for mozjpeg works almost exactly the same way, but it has some extra option flags, can take JPEG input (the others can't), and re-defines the "-baseline" option to something more intuitive (see v2.1 release notes).

Re:Using Mozjpeg to Create Efficient JPEGs by coob on Wednesday August 06, 2014 @01:16PM (#8143560)
I've not seen significant ( > ~1%) improvement over jpegoptim.
Re:Using Mozjpeg to Create Efficient JPEGs by niutech on Thursday August 07, 2014 @03:18PM (#8149586)
How does mozJPEG compare with WebP in terms of size with the same quality?
Re:Using Mozjpeg to Create Efficient JPEGs by WhitneyLand on Wednesday August 06, 2014 @02:41PM (#8144094)
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.
Re:Using Mozjpeg to Create Efficient JPEGs by ominous_prime on Wednesday August 06, 2014 @03:33PM (#8144381)
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).

Re:Using Mozjpeg to Create Efficient JPEGs by sxates on Wednesday August 06, 2014 @01:30PM (#8143655)
Just what your designer always wanted - a command line tool to create jpegs!
Re:Using Mozjpeg to Create Efficient JPEGs by mkonecny on Wednesday August 06, 2014 @02:02PM (#8143878)
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.
Re:Using Mozjpeg to Create Efficient JPEGs by Daemon404 on Wednesday August 06, 2014 @02:14PM (#8143960)
I agree, and as stated in my other comment, I believe it needs downstream support to be adopted properly.

To that end I plan to add support to ImageMagick, and perhaps write a PS plugin.

Re:Using Mozjpeg to Create Efficient JPEGs by ahoge on Wednesday August 06, 2014 @04:39PM (#8144723)
Pngout, optipng, deflopt, jpegtran, gifsicle, cwebp, zopfli, and so forth are all command line tools.

I'm not really sure why you think that this stuff is meant for designers. Recompressing images is a frontend optimization. It's something you automate. It's a task for machines, not humans.

Re:Using Mozjpeg to Create Efficient JPEGs by wmil on Wednesday August 06, 2014 @04:57PM (#8144821)
If you care about jpeg size you're probably already using a build/preprocessing system on your assets. This is just another tool in the chain.