Skip to content

Instantly share code, notes, and snippets.

@cweekly
Last active May 17, 2021 20:23
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cweekly/f7cf122af56b126e33332d64709f57d8 to your computer and use it in GitHub Desktop.
Save cweekly/f7cf122af56b126e33332d64709f57d8 to your computer and use it in GitHub Desktop.
CLI ImageMagick (convert, mogrify, etc) create multi-layer favicon.ico from svg
$ brew install imagemagick
# `convert` and `mogrify` provided by imagemagick
$ mogrify --version
Version: ImageMagick 7.0.7-3 Q16 x86_64 2017-09-18 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules
Delegates (built-in): bzlib freetype jng jpeg ltdl lzma png tiff xml zlib
# "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
# or for a one-off (e.g. .png -> .ico)
$ convert favicon.png -define icon:auto-resize=64,48,32,16 favicon.ico
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment