RealFaviconGenerator / realfavicongenerator

Generate favicon for all major platforms
507 stars 23 forks source link

PNGs are not optimized according to OptiPNG (up to 20% reduction) #166

Open Markus00000 opened 9 years ago

Markus00000 commented 9 years ago

Running optipng -o7 reduced the size of several PNGs by up to 20%. I used OptiPNG version 0.7.5. The icons used the high quality, low compression factor.

I am not sure if the optimization causes any problems. So far I have not seen any.

Server load might be an issue, too.

phbernard commented 9 years ago

RFG is using pngquant. It has at least one advantage: by the time, I know the pictures it generates work everywhere.

I'll run some tests on a large sample of pictures to compare both tools.

Markus00000 commented 9 years ago

If you run a test, consider including pngcrush. I have done a (very small) test and its optimization was identical to optipng. It might be faster. Both are lossless, at least by default.

Assuming the output files were compatible and the optimization was fast enough, you could keep the six compression options (under the compression tab) using pngquant or pngnq and just losslessly optimize all their output files with optipng or pngcrush.

In my test, pngquant and pngnq produced identical file sizes with default options. Again, one might be faster.

dandv commented 9 years ago

+1 for optipng.

rugk commented 8 years ago

Also https://tinypng.com/ shows the PNGs could be optimized further. They also offer an API for doing this, but it is only free for few pictures.

phbernard commented 8 years ago

Actually TinyPNG was the very first solution RFG used to compress icons. But I preferred using a local tool. After all RFG already calls ImageMagick, so it's natural to use PNGQuant (the current tool) or OptiPNG (the probable next one).

The next action here is to run a test on a few hundred packages with:

And compare :

And I also need to understand the losslessness of these tools. For example PNGQuant is "a bit" lossy.

Markus00000 commented 8 years ago

You could also try zopflipng “to perform very good, but slow, deflate or zlib compression.”

rugk commented 8 years ago

Well.. in this case you could also use the successor brotli - I just doubt it is supported by PNG. :smiley:

phbernard commented 8 years ago

If we come to atypical compression format, I'm thinking of Webp. Although we can't entirely replace PNG by Webp, we can serve Webp images to browsers that support it and fallback to PNG for those that don't. But that's another story :)