Created
February 8, 2014 17:48
-
-
Save saihoooooooo/8887413 to your computer and use it in GitHub Desktop.
make tile-image(50px * 50px) from the same image using ImageMagick.
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/sh | |
| if [ $# -ne 3 ] | |
| then | |
| exit 1 | |
| fi | |
| base=$1 | |
| x=$2 | |
| y=$3 | |
| extension=${base##*.} | |
| mkdir -p /tmp/montile | |
| convert -geometry 50x50 $base /tmp/montile/0.$extension | |
| count=1 | |
| allimg="" | |
| while [ $count -le `expr $x \* $y` ] | |
| do | |
| img=/tmp/montile/${count}.$extension | |
| convert -font /Library/Fonts/Osaka.ttf -pointsize 20 -fill "#ffffff" -annotate 0x0+5+32 $count /tmp/montile/0.$extension $img | |
| allimg="$allimg$img " | |
| count=`expr $count + 1` | |
| done | |
| montage -tile "${x}x${y}" -geometry 50x50 $allimg tile.$extension | |
| rm -rf /tmp/montile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment