Skip to content

Instantly share code, notes, and snippets.

@donaldsteele
Last active November 12, 2018 17:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donaldsteele/7b0843db6675269599c9b565ebc4fe68 to your computer and use it in GitHub Desktop.
Save donaldsteele/7b0843db6675269599c9b565ebc4fe68 to your computer and use it in GitHub Desktop.
Convert folder of svg files to standard windows icon sized .ico files using imagemagik
#!/bin/bash
#requires imagemagik, inkscape and pngquant
#sizes you wish to create
size=(16 32 24 48 72 96 144 152 192 196 256)
for file in *.svg; do
base=${file%.*}
for i in ${size[@]}; do
inkscape $file --export-png="${base}_${i}.png" -w$i -h$i --without-gui
pngquant -f --ext .png "${base}_${i}.png" --posterize 4 --speed 1
convert "${base}_${i}.png" "${base}_${i}.ico"
echo "$file" "${base}"
done
convert $(ls -v ${base}_*.ico) ${base}.ico
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment