#!/bin/bash ########################################################################### ## Copyright (C) Wizardry and Steamworks 2012 - License: GNU GPLv3 ## ## Please see: http://www.gnu.org/licenses/gpl.html for legal details, ## ## rights of fair usage, the disclaimer and warranty conditions. ## ########################################################################### # # The script converts the SVG icons in the current # folder to PNG icons that are suitable to use as # status-bar icons. mkdir -p png tmp for i in *; do TYPE=`file -b $i | awk '{ print $5 }'` if [[ $TYPE == "image" ]]; then # Silver # 14x20 convert -background transparent -alpha on -channel rgba -resize 14x14\> $i tmp/tmp.png mogrify -contrast -contrast -contrast -contrast -contrast tmp/tmp.png mogrify -sharpen 1x2 tmp/tmp.png convert -gravity center -background transparent -extent 14x20 tmp/tmp.png png/"Silver_ON_${i/.svg/.png}" # 27x40 (@2x) convert -background transparent -alpha on -channel rgba -resize 27x27\> $i tmp/tmp.png mogrify -contrast -contrast -contrast -contrast -contrast tmp/tmp.png mogrify -sharpen 1x2 tmp/tmp.png convert -gravity center -background transparent -extent 27x40 tmp/tmp.png png/"Silver_ON_${i/.svg/@2x.png}" # Black # 14x20 convert -background transparent -alpha on -channel rgba -resize 14x14\> $i tmp/tmp.png mogrify -contrast -contrast -contrast -contrast -contrast -contrast -contrast -contrast -contrast -contrast -contrast -contrast -contrast -contrast tmp/tmp.png mogrify -sharpen 1x2 tmp/tmp.png convert -gravity center -background transparent -extent 14x20 -negate tmp/tmp.png png/"Black_ON_${i/svg/png}" # 27x40 convert -background transparent -alpha on -channel rgba -resize 27x27\> $i tmp/tmp.png mogrify -contrast -contrast -contrast -contrast -contrast -contrast -contrast -contrast -contrast -contrast -contrast -contrast -contrast -contrast tmp/tmp.png mogrify -sharpen 1x2 tmp/tmp.png convert -gravity center -background transparent -extent 27x40 -negate tmp/tmp.png png/"Black_ON_${i/.svg/@2x.png}" fi done