forked from nickthecook/archyve
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate-pngs
executable file
·46 lines (37 loc) · 1.04 KB
/
generate-pngs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
export inkscape=/Applications/Inkscape.app/Contents/MacOS/inkscape
if ! [ -e "$inkscape" ]; then
echo 1>&2 "'$inkscape' is not an executable file."
exit 2
fi
asset_dir="app/assets/images"
cd "$asset_dir" || {
echo 1>&2 "Unable to cd to asset directory '$asset_dir'."
exit 5
}
source=archyve.svg
if ! [ -f "$source" ]; then
echo 1>&2 "Source image '$source' does not exist."
exit 4
fi
# sizes
for size in 16 32 64 128 256 512; do
echo "$0: Generating $size"x"$size PNG of '$source'..."
$inkscape -w $size -h $size "$source" -o archyve-"$size"x"$size".png || {
echo 1>&2 "$0: failed to generate png; aborting..."
exit 3
}
done
# favicon
echo "$0: generating 144x144 favicon..."
$inkscape -w 144 -h 144 "$source" -o favicon.png || {
echo 1>&2 "$0: failed to generate png; aborting..."
exit 6
}
# apple touch icon
echo "$0: generating 180x180 apple touch icon..."
$inkscape -w 180 -h 180 "$source" -o apple-touch-icon.png || {
echo 1>&2 "$0: failed to generate apple touch icon; aborting..."
exit 7
}
echo 1>&2 "$0: Done."