How do I convert a .PNG into a .ICO?
You can use the opensource imagemagick convert
utility, that can take several images and pack them in one single icon file. It can also do re-sizing and lots of image manipulation. Imagemagick contains other tools for image handling, is available on multiple platforms (Linux, Windows, Mac Os X, iOS) and can be batched easily, for example in Continuous Integration pipelines.
Here is a basic example exporting a svg
file to a png
file:
convert icon.svg -scale 32 tmp/32.png
And how to pack several several of such png
files in a final ico
file:
convert tmp/16.png tmp/32.png tmp/48.png tmp/128.png tmp/256.png icon.ico
Note that the standalone convert
binary may not installed in the default installation. On Windows, you must check the (quite explicit) Install legacy utilities (e.g. convert) option. In case you missed it, simply use the slightly longer magick convert
command rather than convert
alone.
For one-off tasks I usually just cheat: ConvertICO.com .
If you will be doing this fairly often, you may want to consider the free Photoshop plugin.
Install ffmpeg from: Windows: http://ffmpeg.zeranoe.com/builds/ OSX: http://ffmpegmac.net/
From the shell, use the following command to convert PNG to ICO.
ffmpeg -i img.png img.ico
Also if you use ffmpeg regularly, don't forget to add it your PATH variable.