10

I have created a favicon.ico file that contains three sizes of .png icon sizes, 16px, 32px, and 64px.

In my Mac Finder, I have their sizes at 339b, 1kb, and 4kb respectively after optimizing them using ImageOptim. So let's maybe round up to 6kb?

However, when I run this ImageMagick command:

convert 16.png 32.png 64.png myfav.ico

The resulting .ico file is 22kb!

This is a pretty large file and unexpected.

What did I do wrong? What can I do to make it smaller (if anything)?

Drewdavid
  • 3,071
  • 7
  • 29
  • 53

1 Answers1

14

The ico file itself is not a compressed one.

You can gzip it and you will see that the gzipped size will be lesser than the summation of the sizes the 3 png files. ico files are most frequently gzipped (using apache, nginx and so on) before being used to reduce the size.

So, the reason they are so big is because the compression algorithm is weak.

AbdealiLoKo
  • 3,261
  • 2
  • 20
  • 36
  • Thanks for your answer, I guess I thought that .ico was just a container to holding the file(s), I didn't think it was like a whole other image format... which I'm guessing now maybe it is? – Drewdavid Jul 14 '15 at 04:25
  • 3
    Usually, the images in an .ico are held as uncompressed BMP images. If you're converting from png, these will probably be stored at 32bits per pixel. When Windows Vista came along, Microsoft added support for embedded PNG files, but this tends to be for 256x256 icons so that older apps don't break. – Paul Dixon Jan 22 '17 at 13:13