# How to create .ico file in Mathematica?

How to create .ico file in Mathematica? I mean the favicon images used for web sites. Directly using Export["file.ico", <some graphical expression>] does not seem to work.

-
If you have imagemagic installed on mac or linux(windows I believe supports this also) I would do convert favicon.ico favicon.png Surely you could easily couple this with an png export. –  William Mar 26 '14 at 0:52
If this is a one time thing I agree with Liam, and the is awash with alternative solutions. –  Pickett Mar 26 '14 at 1:24
What version of Mathematica are you on, and what OS? I'm guessing version 8, right? –  Jens Mar 26 '14 at 1:56
@Problemaniak Have a look also here: ´mathematica.stackexchange.com/questions/13270/…; –  Alexei Boulbitch Mar 26 '14 at 9:06

## 1 Answer

Exporting .ico from Mathematica works fine in version 9.0.1. On Mac, the built-in function sips tells me that it only supports image sizes that are a power of 2. So you could try to create the desired file using this:

Export["img.ico", img, ImageSize -> {256, 256}]


where img is the image to be exported. However, in version 9.0.1 I'm able to export arbitrarily sized images to .ico as well.

-
As for the ImageSize, the documentation says:"ICO supports a maximum of 256*256 pixels images. Export will scale down Image and Graphics larger than 256 pixels to fit." –  sunt05 Mar 26 '14 at 4:30
So, ImageSize -> {256, 256} in Jens' program above is not necessary, right? –  qazwsx Mar 26 '14 at 5:53
I just did an experiment which seems to confirm that ImageSize -> {256, 256} is not necessary, at least for Mathematica 9.0.1 in Mac. –  qazwsx Mar 26 '14 at 5:56
@Problemaniac It's not necessary, but I threw it in as a guess because I don't know for sure why the OP is having trouble. Maybe the answer boils down to: upgrade to version 9.0.1. –  Jens Mar 26 '14 at 5:58