Created
May 23, 2014 16:15
-
-
Save arjan/1de37bc35da656af0e62 to your computer and use it in GitHub Desktop.
Quickly create a 9-patch image suitable as splash screen (Android)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
FILE="$1" | |
OUT=$(echo $FILE|sed -e 's/\./.9./') | |
$(identify -format "export WIDTH=%w" splash.png) | |
$(identify -format "export HEIGHT=%h" splash.png) | |
convert $FILE -bordercolor none -border 1 $OUT | |
mogrify -fill black \ | |
-draw "line 1,0 2,0" \ | |
-draw "line 0,1 0,2" \ | |
-draw "line $(($WIDTH-2)),0 $(($WIDTH-1)),0" \ | |
-draw "line 0,$(($HEIGHT-2)) 0,$(($HEIGHT-1))" \ | |
-draw "line 1,$(($HEIGHT+1)) $(($WIDTH-1)),$(($HEIGHT+1))" \ | |
-draw "line $(($WIDTH+1)),1 $(($WIDTH+1)),$(($HEIGHT-1))" \ | |
$OUT | |
echo "Written $OUT" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment