File tree 1 file changed +31
-0
lines changed
1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # This script converts all SVGs in the lila/public/piece folder to PNGs in the output folder using Inkscape.
4
+ # Script taken from @tiagoamaro's PR: https://github.com/lichess-org/flutter-chessground/pull/28
5
+
6
+ SOURCE_DIR=" ./lila/public/piece"
7
+ DEST_DIR=" ./output"
8
+ SCALING_FACTORS=(" 1 ." " 2 ./2.0x" " 3 ./3.0x" " 4 ./4.0x" )
9
+
10
+ for dname in $( ls -d $SOURCE_DIR /* ) ; do
11
+ if [ -d " $dname " ]; then
12
+ for factor_folder in " ${SCALING_FACTORS[@]} " ; do
13
+ read -r -a factor_folder_array <<< " $factor_folder"
14
+ factor=${factor_folder_array[0]}
15
+ folder=${factor_folder_array[1]}
16
+ for fname in $( ls $dname ) ; do
17
+ fpath=" $dname /$fname "
18
+ if [ -f " $fpath " ]; then
19
+ out_folder=" $DEST_DIR /${dname##*/ } /$folder "
20
+ echo $out_folder
21
+ mkdir -p $out_folder
22
+ fname_without_extension=" ${fname% .* } "
23
+ png=" $out_folder /$fname_without_extension .png"
24
+ echo " Converting $fpath to $png "
25
+ size=$(( 128 * factor))
26
+ inkscape --export-type=" png" --export-width=" $size " --export-height=" $size " --export-filename=" $png " $fpath &
27
+ fi
28
+ done
29
+ done
30
+ fi
31
+ done
You can’t perform that action at this time.
0 commit comments