Last modified: 2012-05-17 17:26:05 UTC
ImageMagick 'convert' has problems when scaling PNG images: the resulting thumbnails can be really big. [edward@localhost build]$ identify before.png after.png before.png PNG 800x533 800x533+0+0 8-bit PseudoClass 256c 312KB 0.000u 0:00.010 after.png[1] PNG 400x267 400x267+0+0 8-bit DirectClass 302KB 0.000u 0:00.000 But since MediaWiki uses 8-bit thumbnails only, we have a perfect opportunity to make a workaround on MediaWiki side: we can force PseudoClass (i.e. paletted image with 256 colors). When converting, pass "-type Palette" as an argument. [edward@localhost build]$ identify after2.png after2 PNG 400x267 400x267+0+0 8-bit PseudoClass 256c 87.4KB 0.000u 0:00.000 As you can see, this thumbnail is 4 times smaller.
Created attachment 10614 [details] this patch adds -type Palette to ImageMagick convert invocation
Who says we only use images with 256 colours? I don't think that's an accurate statement.
But Bitmap.php is currently passing '-depth 8' to 'convert'.
Sorry, I've mistaken "8bit" per PNG8, while it's PNG24 (8 bits per color). Obviously, the initial patch isn't enough then (this switch should only be passed if the original image was in PNG8).
Never mind though.