-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgen.sh
executable file
·71 lines (59 loc) · 1.3 KB
/
gen.sh
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
SRC="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
pushd $SRC &> /dev/null
LOGO=usql
ICON=icon
OPTIMIZED=${LOGO}-optimized
MINIMIZED=${LOGO}-minimized
WIDTH=220
HEIGHT=80
# optimize
svgo \
--pretty \
--indent=2 \
--precision=4 \
--output=$OPTIMIZED.svg \
${LOGO}.svg
# remove width + height attributes and convert to viewBox
#perl -pi -e 's/ (width|height)="100%"//g' $OPTIMIZED.svg
#perl -pi -e 's/width="90" height="90"/viewBox="0 0 90 90"/' $OPTIMIZED.svg
# minimize
svgo \
--precision=4 \
--output=$MINIMIZED.svg \
$OPTIMIZED.svg
# generate png
inkscape \
--export-area-page \
--export-width=$((WIDTH*8)) \
--export-height=$((HEIGHT*8)) \
--export-type=png \
-o $LOGO.png \
$LOGO.svg
inkscape \
--export-area-page \
--export-width=$((WIDTH/2)) \
--export-height=$((HEIGHT/2)) \
--export-type=png \
-o $LOGO-small.png \
$LOGO.svg
inkscape \
--export-area-page \
--export-width=$((WIDTH*2)) \
--export-height=$((HEIGHT*2)) \
--export-type=png \
-o $LOGO-medium.png \
$LOGO.svg
# icons
for i in 32 48 64 128 256 512; do
# generate png
inkscape \
--export-area-page \
--export-width=$i \
--export-height=$i \
--export-type=png \
-o $ICON-${i}x${i}.png \
$ICON.svg
done
img2sixel --bgcolor '#000000' < usql.png > usql.sixel
popd &> /dev/null