Skip to content

Instantly share code, notes, and snippets.

@pfig
Created February 12, 2012 12:01
Show Gist options
  • Star 106 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save pfig/1808188 to your computer and use it in GitHub Desktop.
Save pfig/1808188 to your computer and use it in GitHub Desktop.
Make a multi-resolution favicon.ico from a source image, using ImageMagick
#!/bin/bash
# from
# http://bergamini.org/computers/creating-favicon.ico-icon-files-with-imagemagick-convert.html
convert source-WxW.png -resize 256x256 -transparent white favicon-256.png
convert favicon-256.png -resize 16x16 favicon-16.png
convert favicon-256.png -resize 32x32 favicon-32.png
convert favicon-256.png -resize 64x64 favicon-64.png
convert favicon-256.png -resize 128x128 favicon-128.png
convert favicon-16.png favicon-32.png favicon-64.png favicon-128.png favicon-256.png -colors 256 favicon.ico
@jcklpe
Copy link

jcklpe commented Aug 20, 2018

@niittymaa Is it possible to use this with a higher resolution like 512?

@sec0ndhand
Copy link

If you have docker installed this works and writes the ICOs to the same folder where your SVGs are:

docker run -v /Path/to/your/local/SVGs:/images -it umnelevator/imagemagick mogrify -path /images -format ico -density 600 -define icon:auto-resize=256,128,64,48,40,32,24,16 /images/*.svg

just replace /Path/to/your/local/SVGs with your folder of SVGs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment