Last modified: 2014-07-19 20:13:21 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T70145, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 68145 - Apply jpgcrush (mozjpeg) over all thumbnails
Apply jpgcrush (mozjpeg) over all thumbnails
Status: NEW
Product: MediaWiki extensions
Classification: Unclassified
VipsScaler (Other open bugs)
master
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: performance
Depends on:
Blocks: 41371 multimedia
  Show dependency treegraph
 
Reported: 2014-07-17 08:51 UTC by Nemo
Modified: 2014-07-19 20:13 UTC (History)
9 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Nemo 2014-07-17 08:51:12 UTC
The weight of JPEG thumbnails, while varying less than PNG thumbnails', is often a relevant factor in the loading times observed on random Wikipedia pages, even with a fast connection. It may be even more important for MediaWikis using larger thumbnails.

https://github.com/mozilla/mozjpeg 2 was just released, see https://blog.mozilla.org/research/2014/03/05/introducing-the-mozjpeg-project/ and http://thenextweb.com/insider/2014/07/15/mozilla-releases-mozjpeg-2-0-facebook-tests-backs-jpeg-encoder-60000-donation/ for introduction, and should be relatively trivial to implement as "second pass" over JPEG thumbnails produced, right?

I know that VipsScaler is currently only used by Wikimedia wikis for PNGs (and that it's named after Vips), but would such an optimisation be in scope for this extension? If not, should we instead upstream a request to include a jpgcrush-like functionality in Vips; or use some other way?
Comment 1 Gilles Dubuc 2014-07-17 11:59:04 UTC
A second pass over existing jpgs would be quite destructive and introduce compression artifacts. This is only worth considering as a swap-in replacement for imagemagick when we want to generate jpgs. One point that the github page and the announcements make no mention od, however, is which input formats are possible. The sample images on github are bmp, jpg, ppm and txt. In that area I have a feeling that imagemagick won't be replaceable. Anyway, I think it should rather go in core, where the conversion to jpgs happens with the various encoders? Definitely worth exploring!
Comment 2 Nemo 2014-07-17 12:02:48 UTC
(In reply to Gilles Dubuc from comment #1)
> A second pass over existing jpgs would be quite destructive and introduce
> compression artifacts.

Are you just giving this for granted, or is the consideration specifically based on tests and/or the algorithm they follow? (I didn't inspect either.)
Comment 3 Gilles Dubuc 2014-07-17 12:30:31 UTC
> Are you just giving this for granted, or is the consideration specifically
> based on tests and/or the algorithm they follow? (I didn't inspect either.)

Any jpeg recompression is lossy, theirs included. Depending on the quality settings, you can get away with a few extra passes without necessarily causing a visual difference that people will notice, but if there's a straightforward way to avoid an extra pass, we should do it. I don't see the point of having an initial imagemagick conversion to jpg if it's going to be immediately followed by a mozjpeg pass, they both achieve the same goal. Ideally someone will hook up mozjpeg into imagemagick directly and it'll be one imagemagick option away.
Comment 4 Nemo 2014-07-17 12:38:49 UTC
(In reply to Gilles Dubuc from comment #3)
> if there's a
> straightforward way to avoid an extra pass

I didn't hear of any.

> I don't see the
> point of having an initial imagemagick conversion to jpg 

Sure, that could be skipped, using Vips instead; that's why I filed this in VipsScaler.\

> if it's going to be
> immediately followed by a mozjpeg pass, they both achieve the same goal.

The goal of our "convert" commands is rescaling.

> Ideally someone will hook up mozjpeg into imagemagick directly and it'll be
> one imagemagick option away.

Sure, that may take years. Which again is why I filed this in VipsScaler, created to work around some limitations of imagemagick in specific areas. :-)
Comment 5 Gilles Dubuc 2014-07-17 12:56:57 UTC
Imagemagick's convert can do the rescaling/sharpening/color profile handling, while targeting an uncompressed format, and then mozjpeg would take care of the JPEG compression.
Comment 6 Bawolff (Brian Wolff) 2014-07-18 20:22:03 UTC
Just to clarify, Vips is an image scaling program, just like image magick. The main differences between vips and image magick is that image magick has more options/is more flexible, and vips has better performance characteristics (particularly memory usage on large files in some formats).

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links