Skip to content

Instantly share code, notes, and snippets.

@YoukouTenhouin
Created May 11, 2013 10:14
Show Gist options
  • Select an option

  • Save YoukouTenhouin/5559501 to your computer and use it in GitHub Desktop.

Select an option

Save YoukouTenhouin/5559501 to your computer and use it in GitHub Desktop.
贴吧头像拼接脚本
if [ $# -lt 2 ] ;then
echo 'usage:genphoto.sh column rows'
exit -1
fi
column=$1
rows=$2
for i in `seq 1 $(($column*$rows))`;do
if [ "`identify $i.jpg | cut -d' ' -f2 | head -n1`" = "GIF" ];then
convert "$i.jpg[0]" $i.jpg
fi
if [ "`identify $i.jpg | cut -d' ' -f3 | head -n1`" != "110x110" ];then
convert "$i.jpg" -resize 110x110\! $i.jpg
fi
done
for i in `seq 1 $column`;do
convert `seq -f"%g.jpg" -s' ' $(($(($i-1))*$rows+1)) $((i*$rows))` +append column$i.jpg
done
convert `seq -f"column%g.jpg" -s' ' 1 $rows` -append result.jpg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment