I noticed DuckDuckGo's favicon has 16x16 and 32x32 images but is much smaller than some other icons with the same dimensions. How can I compress the images inside the ICO file rather than relying on web server compression?
How can I compress a favicon file like DuckDuckGo's?
Answers
An ICO file is a container. Its image entries can be stored as bitmap data or as complete PNG images. The smaller file is likely using PNG entries, while the larger icons use uncompressed bitmap entries.
That isn't the same as gzipping the whole ICO when the server sends it. PNG compression is part of the image data already stored in the file, and it can be used for small icon sizes too, not just 256x256 icons.
Reply to this answer
Try inspecting the entries with icotool or ImageMagick first, then use a tool that can write PNG entries into the ICO. Check the resulting file rather than assuming the export option did what you wanted.
PNG entries have been supported since Windows Vista, but support can depend on the software reading the icon. Test the result in the browsers or other applications you need to support.
Reply to this answer
You can also optimize the PNG images before putting them into the ICO. Tools such as optipng or pngcrush may reduce their size further. The savings will depend on the images, so compare the finished files.
Reply to this answer
Add your answer
Answers are reviewed before publication.
KioskLizard:
That explains why searching for compression of the whole ICO wasn't getting me very far. I'll look for an editor that can save both sizes as PNG entries.