#!/bin/bash

tilesize=20
svgdir=source/svg
pngdir=data/tiles

for subdir in common common/snake lab
do
    for x in $svgdir/$subdir/*.svg
    do
        filename=`basename $x`
        filepath=$pngdir/$subdir/${filename/svg/png}
        rsvg-convert $x -w $tilesize -h $tilesize -o $filepath
        pngcrush -q $filepath tmp && mv tmp $filepath
    done
done
