Skip to content

Instantly share code, notes, and snippets.

@azam

azam/svg2ico.sh

Last active Jun 18, 2021
Embed
What would you like to do?
Convert SVG to ICO using ImageMagick, with transparent background and multi-size icons
convert -density 256x256 -background transparent favicon.svg -define icon:auto-resize -colors 256 favicon.ico
@mjhasbach

This comment has been minimized.

Copy link

@mjhasbach mjhasbach commented Oct 13, 2015

The icon can also be colored:

convert -density 384 -background transparent -fill "#607D8B" -colorize 100 favicon.svg -define icon:auto-resize -colors 256 favicon.ico
@keith24

This comment has been minimized.

Copy link

@keith24 keith24 commented May 8, 2016

For anyone else wondering why the density must be set

@graingert

This comment has been minimized.

Copy link

@graingert graingert commented Aug 31, 2016

@mjhasbach @azam @keith24 I'm still getting blurry images with this. Is there an icon:auto-density ?

@drmercer

This comment has been minimized.

Copy link

@drmercer drmercer commented Apr 15, 2017

@graingert I got better results by using -density 256x256 as specified in this SO answer.

@wieczorek1990

This comment has been minimized.

Copy link

@wieczorek1990 wieczorek1990 commented Jul 1, 2019

So to sumarize, use:

convert -density 256x256 -background transparent favicon.svg -define icon:auto-resize -colors 256 favicon.ico
@char1es31

This comment has been minimized.

Copy link

@char1es31 char1es31 commented Jan 15, 2020

This can be done in magick directly:

magick -density 256x256 -background transparent favicon.svg -define icon:auto-resize -colors 256 favicon.ico
@azam

This comment has been minimized.

Copy link
Owner Author

@azam azam commented Jan 16, 2020

Updated with latest working parameters. Thanks all !

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