#!/bin/bash

for file in *.svg; do
    tmp=$(mktemp)
    if scour -i "$file" -o "$tmp" --set-precision=5 --enable-viewboxing --enable-id-stripping --enable-comment-stripping --shorten-ids --indent=none; then
        mv "$tmp" "$file"
    else
        rm -f "$tmp"
    fi
done


for i in *.svg; do
    p=${i%.svg}.png
    rsvg-convert -h 24 -o ../"$p" "$i"

    optipng -o6 -strip all -- ../"$p"
    printf "\n"
done
