Last modified: 2012-06-26 10:25:20 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 T31659, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 29659 - Indexed PNG thumbnails are blurrier than true-color
Indexed PNG thumbnails are blurrier than true-color
Status: NEW
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
unspecified
All All
: Low normal (vote)
: ---
Assigned To: Nobody - You can work on this!
http://commons.wikimedia.org/wiki/Fil...
: upstream
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-06-30 17:49 UTC by PRO
Modified: 2012-06-26 10:25 UTC (History)
3 users (show)

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


Attachments

Description PRO 2011-06-30 17:49:43 UTC
Thumbnails of PNG images with indexed colors are converted to true-color thumbnails, which result in a greater file size. Indexed-color PNGs should be converted to indexed color Thumbnails.

For example (a grayscale), the same images (8b) converted (to 16b) is sharper: 
http://commons.wikimedia.org/wiki/File:Jürgen_Alberts_-_pv_portrait_02-3.png
Comment 1 Bryan Tong Minh 2011-06-30 17:53:48 UTC
For the indexed colors bug see bug 1218.

The unsharpness should be investigated though so leaving this bug open.
Comment 2 Brion Vibber 2011-06-30 18:00:04 UTC
It's unclear from the bug whether the issue is *file size* or *image quality*... I can't really tell what you're indicating at the given URL. Can you describe how the different versions of this file interact with the issue?


Generally speaking you can't make a nice indexed-color scaled version of an indexed-color image, as scaling it either:

* looks horrible (nearest-neighbor etc)
or
* introduces a huge number of new colors (any kind of nice scaling)

It's possible to try to generate a new optimized indexed palette, but usually all that'll accomplish is making the image look worse again by throwing away color data.

Grayscale images (that are actually declared as grayscale, not indexed-color) *ought* to remain as grayscale rather than being promoted to truecolor, but I'm not sure offhand if we have logic to handle that case properly.
Comment 3 PRO 2011-07-01 00:07:17 UTC
Ok I would remove my first sentence. I mean the issue of quality (not size of thumbs, but these are different too). Maybe this Bug is not sufficiently defined, or too general. Currently I've only tested grayscale images.

The logic can not tell the difference - thumbs from the same image (same colors but only different Bitdepth) to the same truecolor thumbs must be equal (or the indexed should be sharper?)

Another very simple 1b example (minimally, only to detect under magnification): Sharp Trucolor: http://upload.wikimedia.org/wikipedia/commons/thumb/archive/b/b5/20100430150734%21Ping_deny.png/300px-Ping_deny.png
Unsharp Indexed 4b: http://upload.wikimedia.org/wikipedia/commons/thumb/archive/b/b5/20110630223939%21Ping_deny.png/300px-Ping_deny.png
Comment 4 Brion Vibber 2011-07-01 00:26:01 UTC
Ok I did a quick check resizing these versions of the Ping_deny.png image:

a.png -- the truecolor version
b.png -- the grayscale version (it is in fact grayscale, not indexed!)
truecolor.png -- a version explicitly re-saved from Gimp from a.png
gray.png -- a version explicitly converted to grayscale in Gimp from a.png
indexed.png -- a version explicitly converted to indexed color in Gimp from a.png


for x in a.png b.png gray.png indexed.png truecolor.png
do
	convert \
		-quality 95 \
		-background white \
		$x \
		-thumbnail 300x142\! \
		-depth 8 -auto-orient \
		300px-$x
done

The resulting images match what I see from the above-linked thumbs:

* truecolor image, scaled, is still truecolor.
* grayscale image, scaled, is still grayscale. Looks slightly darker and possibly blurrier than scaled version of truecolor image.
* indexed-color image, scaled, becomes truecolor. Looks identical to grayscale version.

So the commands we're giving are exactly the same; ImageMagick itself is applying some slightly different behavior.

Tested:
Version: ImageMagick 6.6.2-6 2011-03-16 Q16 http://www.imagemagick.org
Comment 5 PRO 2011-07-01 15:19:18 UTC
There is no different in grayscale and indexed, so this is a version problem of ImageMagick? 
Another more suitable distinctly Indexed example (gallery from image:The Flying Serpent ArM.png) in http://de.wikipedia.org/wiki/Wikipedia_Diskussion:Grafikwerkstatt#Unterschiedliche_Behandlung_von_Bildformaten
Comment 6 Brion Vibber 2011-07-01 19:06:56 UTC
The JPEG image there will receive additional sharpening that we add explicitly for JPEGs (as most JPEGs are photos and most photos benefit from a little sharpening on scaling, while most PNGs are line-drawings or screenshots and sharpening increases file size dramatically and often looks worse).

The PNG and GIF in theory should render the same (but then the truecolor & grayscale/indexed PNG should also render the same!). It looks like the GIF *does* render the same as the grayscale/indexed PNG, so at least that's consistent behavior between how it treats those two formats.
Comment 7 PRO 2011-07-07 00:58:46 UTC
Now I realize that truecolor PNG also receive extra sharpening (though lesser). So maybe this is more a left feature!? But I would prefer instead a other scaling method for indexed images. [[Proximal interpolation]] or [[Bicubic interpolation]] instead of [[w:Bilinear interpolation]] or [[Lanczos resampling]] (I don't know).
Comment 8 Subfader 2012-04-26 14:46:58 UTC
PNG is the desired format for screenshots etc., but PNG thumbs are unsharp.

Compare: http://www.mediawiki.org/wiki/User:Subfader/PNG_thumbs_unsharp

Please solve this.

JPG thumbs of PNGs are sharper but have more artifacts when you look close, but still better to read than unsharp PNG thumbs.
Comment 9 Subfader 2012-06-26 10:25:20 UTC
See also my request to return thumbs of non-transparent PNG files as JPG: 
https://bugzilla.wikimedia.org/show_bug.cgi?id=37960

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


Navigation
Links