I would like to create .ico
icon for my Windows application dynamically (from the SVG file) by using ImageMagick. How do I do that?
Microsoft lists vari
Modifying hnasarat's answer for windows users. The easiest way to is install InkScape and ImageMagick using Chocolatey and then run the following in a batch file. (It is not as flexible as the other answers you just pass in one svg but it pumps out all the favicons recommended in Favicon Cheat Sheet.
@ECHO off
IF "%1"=="" (
ECHO You must provide an svg file
EXIT /b
)
IF NOT EXIST favicons MD favicons
SET "sizes=16 24 32 48 57 64 72 96 120 128 144 152 195 228 256 512"
FOR %%s IN (%sizes%) DO (
inkscape -z -e favicons/favicon-%%s.png -w %%s -h %%s %1
)
convert favicons/favicon-16.png favicons/favicon-24.png favicons/favicon-32.png favicons/favicon-48.png favicons/favicon-64.png favicons/favicon.ico
Bash one-liner to convert logo.svg
into logo.ico
, using Inkscape to export the png images at various sizes:
eval convert \
'<(inkscape -e /dev/stderr logo.svg -w '{16,24,32,48,64,128,256}' 2>&1 > /dev/null)' \
logo.ico
Inspired by Malcolm MacLeod's answer, but avoiding the explicit loop and the temporary files.
The stderr
and redirection is to avoid Inkscape's success message on stdout
(“Bitmap saved as: /dev/stdout”) ending up in the image data.
magick convert in.jpg -define icon:auto-resize=16,48,256 -compress zip out.ico
http://imagemagick.org/script/command-line-options.php#define