Skip to content

Instantly share code, notes, and snippets.

@azam
Last active February 24, 2025 11:46
Show Gist options
  • Save azam/3b6995a29b9f079282f3 to your computer and use it in GitHub Desktop.
Save azam/3b6995a29b9f079282f3 to your computer and use it in GitHub Desktop.
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
@gsilvan
Copy link

gsilvan commented Nov 29, 2024

If you want your favicon contain only certain sizes, you can specify them by setting `icon:auto-resize=64,48,32,16". This will lead to a much smaller file.

Full command:

convert -density 256x256 -background transparent favicon.svg -define icon:auto-resize=64,48,32,16 -colors 256 favicon.ico

@GarfieldDeepClone
Copy link

GarfieldDeepClone commented Jan 14, 2025

My .ico also has white background when using this command:
magick favicon.svg -density 256x256 -background transparent -colors 256 -define icon:auto-resize="128,64,48,32,16" favicon.ico

What I'm doing wrong?

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