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.

  • $\begingroup$ 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. $\endgroup$ – William Mar 26 '14 at 0:52
  • $\begingroup$ If this is a one time thing I agree with Liam, and the is awash with alternative solutions. $\endgroup$ – C. E. Mar 26 '14 at 1:24
  • $\begingroup$ What version of Mathematica are you on, and what OS? I'm guessing version 8, right? $\endgroup$ – Jens Mar 26 '14 at 1:56
  • $\begingroup$ @Problemaniak Have a look also here: ´mathematica.stackexchange.com/questions/13270/…´ $\endgroup$ – Alexei Boulbitch Mar 26 '14 at 9:06

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.

  • $\begingroup$ 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." $\endgroup$ – sunt05 Mar 26 '14 at 4:30
  • $\begingroup$ So, ImageSize -> {256, 256} in Jens' program above is not necessary, right? $\endgroup$ – qazwsx Mar 26 '14 at 5:53
  • $\begingroup$ 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. $\endgroup$ – qazwsx Mar 26 '14 at 5:56
  • $\begingroup$ @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. $\endgroup$ – Jens Mar 26 '14 at 5:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.