Jump to content

Increasing the jpeg thumbnails quality on the wiki


Quaix
 Share

Recommended Posts

Currently the wiki is set to generate thumbnails with a jpeg quality of 80 for jpeg source files. While this saves somewhat on bandwidth, the image quality suffers with the thumbnail being covered in visible jpeg compression artifacts. This can be especially distracting for screenshots of in-game menus where compression artifacts stand out from an otherwise smooth background. Compare the original to the current thumbnail:

 

[compimg]http://pcgamingwiki.com/images/4/49/Hamiltons_Great_Adventure_-_Cover.jpg|http://pcgamingwiki.com/images/thumb/4/49/Hamiltons_Great_Adventure_-_Cover.jpg/282px-Hamiltons_Great_Adventure_-_Cover.jpg|282|402|q98|q80 - Wiki thumbnail[/compimg]

 

JPEG artifacts are visible all over the image, mainly on Hamilton's shirt and collar, on Sasha, and in the black area around the letters on the bottom.

 

Increasing the quality to q93 using Irfanview removes all visible compression artifacts at the cost of double the filesize:

 

[compimg]http://pcgamingwiki.com/images/1/19/Hamiltons_Great_Adventure_-_Cover_q93.jpg|http://pcgamingwiki.com/images/thumb/4/49/Hamiltons_Great_Adventure_-_Cover.jpg/282px-Hamiltons_Great_Adventure_-_Cover.jpg|282|402|q93 - 75 KB|q80 - 38 KB - Wiki thumbnail[/compimg]

 

The increase in filesize would be less for images with less visual complexity, such as screenshots of in-game menus.

 

For completeness, here is the difference between q98 (original) and q93:

 

[compimg]http://i.imgur.com/E0oQOxw.jpg|http://pcgamingwiki.com/images/1/19/Hamiltons_Great_Adventure_-_Cover_q93.jpg|282|402|q98|q93[/compimg]

 

The difference is almost imperceptible. 

 

I suggest a quality of somewhere between 90 and 93 as being a good tradeoff between visual quality and filesize. Note that q93 might be slightly different for media wiki than it is for Irfanview. Some trial and error might be needed.

Link to comment
Share on other sites

I'll be honest, I really couldn't see any differences between the q80 thumbnail and q98 pic.

I had to use a zoom function to notice a difference... although, there are some situations, where this compression is actually very easy to spot.

Link to comment
Share on other sites

Happy to implement this change. However I have no idea how we actually achieve this on the MediaWiki platform. Anyone have any idea?

 

Here is what a google search turned up:

 

There doesn't seem to be any configuration setting in MediaWiki to set this compression quality in a nice way (like in LocalSettings.php). The value of 80% for JPGs seems to be hardcoded in ./includes/media/Bitmap.php. In Version 1.15, the value is set in line 109 of the file, in the more recent version 1.18, the code is in line 272. I just changed the value of  80 to 95, and newly uploaded images got better thumbnails. Note that changing the sourcecode of MediaWiki like this might be a bad idea if you don't know exactly what you are doing. For instance, after an update, you are likely to lose this change, or you might even corrupt your MediaWiki installation.

 

 

The page also mentions that to have MW recreate older thumbnails, set the $wgThumbnailEpoch variable to the current date.

 

Here is the mediawiki help page for image administration. If this mediawiki installation uses ImageMagick, it's a matter of changing "-quality 80" to "-quality 93" on the command line where it creates thumbnails.

 

I hope this gives you a starting point.

Link to comment
Share on other sites

  • 2 weeks later...
  • 9 years later...
Guest
This topic is now closed to further replies.
 Share

  • Found PCGamingWiki useful? Please consider making a Donation or visiting our Patreon.
  • Who's Online   0 Members, 0 Anonymous, 360 Guests (See full list)

    • There are no registered users currently online
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Forum Statistics

    1.7k
    Total Topics
    9.1k
    Total Posts
×
×
  • Create New...