summaryrefslogtreecommitdiff
path: root/icon/make-png
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-06-14 17:51:46 -0700
committerKeith Packard <keithp@keithp.com>2014-06-14 17:51:46 -0700
commit4ec960b705b87b15d015abb2a9a3e23eee414f1d (patch)
tree905cef8d9d7fb2781f1f7a22ae1bb39df8dfd2d2 /icon/make-png
parent951fda701ed31f4d8390c130215597e8f63e837e (diff)
icon: Create all icons from .svg files
Remove images from repository, leaving only the svg files and build instructions Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'icon/make-png')
-rwxr-xr-xicon/make-png34
1 files changed, 34 insertions, 0 deletions
diff --git a/icon/make-png b/icon/make-png
new file mode 100755
index 00000000..748cf32e
--- /dev/null
+++ b/icon/make-png
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+case $# in
+3)
+ ;;
+*)
+ echo "Usage: $0 <input.svg> <size> <output.png>" 1>&2
+ exit 1
+ ;;
+esac
+
+SVG=$1
+SIZE=$2
+PNG=$3
+
+SHADOW=$(($SIZE / 16))
+IMAGE=$(($SIZE - $SHADOW))
+
+OPACITY=80
+BLUR=$(($SHADOW / 4))
+SHIFT=$(($SHADOW - $BLUR))
+
+echo SHADOW $SHADOW IMAGE $IMAGE OPACITY $OPACITY SHIFT $SHIFT BLUR $BLUR
+
+TMP=image-$$.png
+
+trap "rm $TMP" 0 1 15
+
+rsvg-convert -w $IMAGE -h $IMAGE -o $TMP $SVG
+
+convert $TMP \
+ \( +clone -background black -shadow ${OPACITY}x${BLUR}+${SHIFT}+${SHIFT} \) \
+ +swap -background none -layers merge -crop ${SIZE}x${SIZE}+0+0 +repage $PNG
+