dir="$data/${svg%/*}"
tga="$data/${svg%.*}.tga"
- if [ "$ext" = "svg" ] && [ -f "$svg" ] && [ "$svg" -nt "$tga" ]; then
+ # IF source file has extension .svg AND it exists AND
+ # destination file does NOT exist, OR source file is newer than destination file
+ if [ "$ext" = "svg" ] && [ -f "$svg" ] && [ ! -f "$tga" -o "$svg" -nt "$tga" ]; then
echo "Rendering $tga"
w=$(identify -format "%w" "$svg")
scale=$(echo "s=sqrt($maxPixels/$w/$h);if(s>$maxScale)s=$maxScale;s" | bc)
mkdir -p "$dir"
- rsvg-convert -z "$scale" "$svg" | convert - -scale "$w" "$tga"
+ # -auto-orient works around an inversion regression present in imagemagick 6.9.11-60
+ rsvg-convert -z "$scale" "$svg" | convert - -auto-orient -scale "$w" "$tga"
+ else
+ printf "NOT rendering source $svg because "
+ if [ ! "$ext" = "svg" ]; then
+ printf "file extension is not \".svg\"\n"
+ elif [ ! -f "$svg" ]; then
+ printf "file not found\n"
+ else
+ printf "$svg is not newer than $tga\n"
+ fi
fi
done