2019-02-05 12:06:33 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2020-05-29 10:00:07 -04:00
|
|
|
NC='\033[0m'
|
|
|
|
RED='\033[0;31m'
|
|
|
|
YELLOW='\033[0;33m'
|
|
|
|
|
2021-09-21 00:17:46 -04:00
|
|
|
if [[ -z $1 ]]; then
|
2020-05-29 10:00:07 -04:00
|
|
|
echo -e "${RED}You must include an SVG file to convert!${NC}"
|
2019-02-05 12:06:33 -05:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
outfile=$2
|
2021-09-21 00:17:46 -04:00
|
|
|
if [[ -z $outfile ]]; then
|
2019-02-05 12:06:33 -05:00
|
|
|
outfile="logo.ico"
|
|
|
|
fi
|
|
|
|
|
2021-09-21 00:17:46 -04:00
|
|
|
if ! command -v inkscape &> /dev/null; then
|
2020-05-29 10:00:07 -04:00
|
|
|
echo -e "${YELLOW}Could not find inkscape; $outfile not built!${NC}"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2019-02-05 12:06:33 -05:00
|
|
|
echo "Generating $outfile from $1..."
|
|
|
|
size_list=(16 24 32 48 64 128 256)
|
2021-09-21 00:17:46 -04:00
|
|
|
for size in "${size_list[@]}"; do
|
|
|
|
inkscape -z -e $size.png -w $size -h $size "$1" >/dev/null 2>/dev/null
|
2019-02-05 12:06:33 -05:00
|
|
|
done
|
|
|
|
|
2021-09-21 00:17:46 -04:00
|
|
|
images=$(printf "%s.png " "${size_list[@]}")
|
2019-02-05 12:06:33 -05:00
|
|
|
convert $images $outfile
|
|
|
|
|
|
|
|
rm $images
|