How does tinypng.com minimize pictures?

I recently discovered tinypng.com, which helped me to minimize a picture on my website from over 60k to less than 20k by keeping the same quaility (for me personally at first sight, I’m not so into graphics so I can not tell you exactly – it’s my subjective opinion). On their website they write the following about how they do that:

When you upload a PNG (Portable Network Graphics) file, similar colors in your image are combined. This technique is called “quantization”. By reducing the number of colors, 24-bit PNG files can be converted to much smaller 8-bit indexed color images. All unnecessary metadata is stripped too. The result better PNG files with 100% support for transparency. Have your cake and eat it too!

As I find the service very important for running a website, I don’t want to be dependent on them – they can disappear tomorrow, but I still have to minize pictures. That’s I came here to ask: How can I do the same within my gimp installation or by using the Linux command line tool imagemagick?

Answer

For Gimp

You can get color-indexed PNG in Gimp by changing the image mode to Color-indexed before exporting. However, this restricts you to a binary alpha channel (in other words, this won’t support the proportional opacity available in PNG), even if you can mitigate this by using the “Dither transparency” setting when doing the conversion.

For ImageMagick

convert input.png PNG8:output.png

Now, it depends what kind of PNG you have. CGI such as logos or screenshots compress very well in PNG, and color-indexing them will possibly blur edges, so the color-indexed version won’t look as good and won’t be much smaller.

Attribution
Source : Link , Question Author : manifestor , Answer Author : xenoid

Leave a Comment