view scripts/make_pngs.sh @ 598:0a2cc2ee16c2

Fix loading of help file. It needs to be loaded as a string since we join lines using a string.
author Simon Cross <hodgestar@gmail.com>
date Sat, 14 Jan 2023 19:04:47 +0100
parents acfcd3db4bca
children
line wrap: on
line source

#!/bin/bash

set -e
set -u

tilesize=20

svgroot=source/svg
pngroot=data

for sourcepath in `find "$svgroot" -name "*.svg"`
do
    sourcefile="`basename $sourcepath`"
    sourcedir="`dirname $sourcepath`"
    destdir="${sourcedir/#$svgroot/$pngroot}"
    mkdir -p "$destdir"
    destpath="$destdir/${sourcefile/%svg/png}"
    opts=""
    echo "$sourcepath" | grep -Fq /tiles/ && opts="-w $tilesize -h $tilesize"
    rsvg-convert "$sourcepath" $opts -o "$destpath"
    pngcrush -q "$destpath" tmp && mv tmp "$destpath"
done