Skip to content

Instantly share code, notes, and snippets.

@jameslzhu
Created June 2, 2020 07:06
Show Gist options
  • Save jameslzhu/51c299c9a591bebc2ba68f1a47bb1fcf to your computer and use it in GitHub Desktop.
Save jameslzhu/51c299c9a591bebc2ba68f1a47bb1fcf to your computer and use it in GitHub Desktop.
Converts a favicon SVG to PNG and ICO.
#!/usr/bin/env bash
# Convert svg to png with inkscape
inkscape --export-type=png -o assets/images/favicon.png -w 64 -h 64 \
--export-background-opacity=0 \
./assets/images/favicon.svg
# Convert png to ico with imagemagick
convert ./assets/images/favicon.png \
\( -clone 0 -resize 16x16 \) \
\( -clone 0 -resize 32x32 \) \
\( -clone 0 -resize 48x48 \) \
\( -clone 0 -resize 64x64 \) \
-delete 0 -alpha remove -colors 256 favicon.ico
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment