-
-
Save pfig/1808188 to your computer and use it in GitHub Desktop.
#!/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 |
keep it short and simple
RTFM
http://www.imagemagick.org/Usage/thumbnails/#favicon
convert favicon.png -bordercolor white -border 0 \
\( -clone 0 -resize 16x16 \) \
\( -clone 0 -resize 32x32 \) \
\( -clone 0 -resize 48x48 \) \
\( -clone 0 -resize 64x64 \) \
-delete 0 -alpha off -colors 256 favicon.ico
@BersBaD 's solution worked perfectly for me. Thanks!
This is simpler in newer versions of ImageMagick (seemingly 6.8.8-3 and later), and background transparency is retained with this:
convert favicon.png -define icon:auto-resize=64,48,32,16 favicon.ico
Source: dlemstra's comment on http://www.imagemagick.org/discourse-server/viewtopic.php?t=26252
I found mogrify quite useful in converting icons to multilayered ICO format from SVG images. This command batch converts all SVG images from selected folder and converts those to multilayered ICO format.
mogrify -path ../PathToFolder/ -format ico -density 600 -define icon:auto-resize=128,64,48,32,16 *.svg
Does this work with SVGs?
@eberkund yes
@niittymaa Is it possible to use this with a higher resolution like 512?
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.
For some reason, I needed a fully shaved yak. As a result: