#!/bin/sh -e # TASK # Insert date, make the selected gametype symbol visible, # then render and optimize png files of the three medals. # # DEPENDENCIES # convert # pngquant (Reduces colors to 8bit) # optipng (Removes unnecessary data) # advpng (Compresses with zopfli algorithm) # # USAGE # $0 SIZE(Power of two, optimal=64) # GAMETYPE(ca|ctf|cts|dm|dom|duel|ft|insta|ka|kh|lms|nb|ons|tdm|xonotic) \ # MONTH(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC) \ # YEAR(YY) size="$1" type="$2" month="$3" year="$4" mkdir -p "png" for num in "1" "2" "3"; do svg="medal$num.svg" png="png/$size-$type-$year-${month,,}-$num.png" # Render sed -e "s|width=\"64\" height=\"64|width=\"$size\" height=\"$size|" \ -e "s|id=\"$type\" opacity=\"0|id=\"$type\" opacity=\"1|" \ -e "s|MMM|$month|" \ -e "s|YY|$year|" "$svg" |\ convert -background none - "$png" # Optimize pngquant --nofs --speed 1 --quality 70-75 --skip-if-larger --force --output "$png" "$png" optipng -o 5 -strip all "$png" advpng --recompress --shrink-insane -i 1000 "$png" done