Skip to content

Instantly share code, notes, and snippets.

@saihoooooooo
Created February 8, 2014 17:48
Show Gist options
  • Select an option

  • Save saihoooooooo/8887413 to your computer and use it in GitHub Desktop.

Select an option

Save saihoooooooo/8887413 to your computer and use it in GitHub Desktop.
make tile-image(50px * 50px) from the same image using ImageMagick.
#!/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