37 lines
917 B
Bash
Executable File
37 lines
917 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# -*- coding: utf8 -*-
|
|
|
|
# Source: https://gessel.blackrosetech.com/2020/12/21/favicon-generation-script
|
|
|
|
# this makes the output verbose
|
|
set -ex
|
|
|
|
# collect the file name you entered on the command line (file.svg)
|
|
svg=$1
|
|
|
|
# set the sizes to be generated (plus 310x150 for msft)
|
|
size=(16 32 48 70 76 120 128 150 152 167 180 192 310 512)
|
|
|
|
# set the write director as a favicon directory below current
|
|
out="$(pwd)"
|
|
out+="/favicon"
|
|
mkdir -p $out
|
|
|
|
echo Making bitmaps from your svg...
|
|
|
|
for i in ${size[@]}; do
|
|
inkscape -o "$out/favicon-$i.png" -w $i -h $i $svg
|
|
done
|
|
|
|
# Microsoft wide icon (annoying, probably going away)
|
|
inkscape -o "$out/favicon-310x150.png" -w 310 -h 150 $svg
|
|
|
|
echo Compressing...
|
|
for f in $out/*.png; do pngquant -f --ext .png "$f" --posterize 4 --speed 1 ; done;
|
|
|
|
echo Creating favicon...
|
|
convert $out/favicon-512.png -define icon:auto-resize=48,32,16 $out/favicon.ico
|
|
|
|
echo Done
|
|
|