How to convert a square SVG to all-size ICO?

I’ve drawn an icon in InkScape and would like to export it to an ICO file that would include sprites for all the reasonable resolutions (16×16, 32×32, … 256×256 etc). How can this be done (without using huge and expensive software like Photoshop, CorelDraw etc)?

Answer

A command line solution:

  1. Export your SVG master.svg to PNG with Inkscape:
# Install on Ubuntu
sudo apt-get install inkscape
# Other systems: make sure Inkscape is in your PATH

inkscape -w 16 -h 16 -e 16.png master.svg
inkscape -w 32 -h 32 -e 32.png master.svg
inkscape -w 48 -h 48 -e 48.png master.svg
  1. Convert the PNG images to ICO with ImageMagick:
# Install on Ubuntu
sudo apt-get install imagemagick

convert 16.png 32.png 48.png icon.ico
  1. Optional – Make sure your ICO contains everything:
$ identify icon.ico
icon.ico[1] ICO 16x16 16x16+0+0 32-bit sRGB 21.2KB 0.000u 0:00.000
icon.ico[0] ICO 32x32 32x32+0+0 32-bit sRGB 21.2KB 0.000u 0:00.000
icon.ico[0] ICO 48x48 48x48+0+0 32-bit sRGB 21.2KB 0.000u 0:00.000

Attribution
Source : Link , Question Author : Ivan , Answer Author : Community

Leave a Comment