Page MenuHomePhabricator

Offer a configuration option to specify desired JPEG (thumbnail) quality
Open, Needs TriagePublic


JPEG images that are scaled down to smaller sizes tend to have significant artifacts. Can the quality setting be made customizable?

How to reproduce:

  1. Upload a JPEG image to the wiki.
  2. Use the JPEG image in a way that causes a thumbnail to be generated. For example, [[File:Filename.jpg|120px]].
  3. Observe the extreme quality loss. An unacceptable amount of JPEG artifacts (blockiness, blurriness, discoloration) are present.

JPEG artifacts are to be expected when using JPEG files, however one would expect a quality setting to be available for the administrator of a MediaWiki installation to specify just how much JPEG artifacting is introduced when scaling images.

In some cases, the quality loss is so bad that we are forced to convert JPEG images to PNG so the images can be thumbnailed properly and used on the wiki.

Here is a comparison we made on our wiki:

We are using MediaWiki 1.30 and ImageMagick is doing the thumbnailing.

convert --version
Version: ImageMagick 6.8.9-9 Q16 x86_64 2017-07-31
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib cairo djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png rsvg tiff wmf x xml zlib

Event Timeline

Aklapper changed the task status from Open to Stalled.Apr 16 2018, 8:14 AM

Hi @Prod, thanks for taking the time to report this!
Unfortunately this report lacks some information. If you have time and can still reproduce the problem: Please add a more complete description to this report.
That can be a clear list of specific steps to reproduce the situation, as little details sometimes matter, so that nobody needs to guess how you performed each step, describing actual results and expected results after performing the steps to reproduce, providing a link to a public website where the issue can be seen, if you see the same behavior when you are not logged in, information about your web browser(s), MediaWiki version information (if it is not on a Wikimedia wiki), etc.
You can edit the task description by clicking Edit Task.
Ideally, exact and clear steps to reproduce should allow any other person to follow these steps (without having to interpret those steps) and see the same results. Problems that others can reliably reproduce can get fixed faster. Thanks!

Prod changed the task status from Stalled to Open.Apr 17 2018, 1:42 AM
Prod updated the task description. (Show Details)

I have updated the description with our MediaWiki version, imagemagick version, and some comments from some of the power users.

ImageMagick offers a quality parameter:

I don't see yet how MediaWiki is involved here...

Although ImageMagick offers a quality parameter, MediaWiki does not give us access to it.

We request a MediaWiki configuration option that lets us specify our desired quality parameter. Alternatively, access to set the filter parameter in imagemagick could also help us improve the quality of the thumbnails.

Aklapper renamed this task from JPEG quality cannot be configured to Offer a configuration option to specify desired JPEG (thumbnail) quality.Apr 18 2018, 10:14 AM
Aklapper edited projects, added MediaWiki-File-management; removed Multimedia.

Change 427707 had a related patch set uploaded (by Skizzerz; owner: Skizzerz):
[mediawiki/core@master] Add $wgJpegQuality to control jpg thumb quality

Change 427707 merged by jenkins-bot:
[mediawiki/core@master] Add $wgJpegQuality to control jpg thumb quality