tipride/genflags.sh

25 lines
730 B
Bash
Raw Normal View History

2024-04-23 02:28:16 +00:00
#!/bin/sh
mkdir svg png
for file in keys/*.txt
do
line=$(cat $file | grep "d=" | cut -c3-)
name=svg/${file%.*}.svg
j=0
echo -n '<svg version="1.1" baseProfile="full" width="600" height="400" viewBox="0 0 63 42" xmlns="http://www.w3.org/2000/svg">' > $name
echo $line | fold -w6 | while read col
do
if [ $j == 21 ]
then
col=$(echo $col | sed 's/.$//')
printf '<path d="M0,21 q15.75,-41,31.5,0 t 31.5 0" stroke="#%s%s%s" stroke-linecap="round" fill="none"/>' $col $col $col >> $name
else
x=$(($j%7*9))
y=$(($j/7*14))
printf '<rect x="%s" y="%s" width="9" height="14" fill="#%s"/>' $x $y $col >> $name
fi
j=$(($j+1))
done
echo -n '</svg>' >> $name
convert svg/${file%.*}.svg png/${file%.*}.png
done