Skip to content

Instantly share code, notes, and snippets.

@Jim-Holmstroem
Created January 26, 2019 10:50
Show Gist options
  • Save Jim-Holmstroem/2efa6a01df1d5fee21be820f61e0a02a to your computer and use it in GitHub Desktop.
Save Jim-Holmstroem/2efa6a01df1d5fee21be820f61e0a02a to your computer and use it in GitHub Desktop.
convert image file to .ico icon favicon in linux (perhaps works on mac as well) with imagemagick convert
#!/usr/bin/env bash
set -ex
input_image=$1
output_image=$2
## Example usage: ./convert_to_favicon.sh icon.svg favicon.ico
for d in 16 32; do
convert -resize ${d}x${d} -flatten -colors 256 ${input_image} /tmp/favicon-${d}.ico
done
convert /tmp/favicon-{16,32}.ico favicon.ico
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment