#!/bin/sh

generate() {
	cd "$1"
	destinationDir="$2"
	border="${3}x${3}"
	for file in `find -type f -name "*.png"`; do
		destination="$destinationDir/$file"
		convert "$file" \
			-bordercolor Transparent \
			-border "$border" \
			-background Transparent \
			"../../${destination}"
	done
	cd -
}

[ -z "$1" ] && echo "provide source <pack>/<size>"      && exit 2;
[ -z "$2" ] && echo "provide destination <pack>/<size>" && exit 2;
[ -z "$3" ] && echo "provide border width"              && exit 2;

generate "$1" "$2" "$3"
