#!/bin/sh # # $Id: iMultiBorder,v 1.1 2001/11/20 03:11:28 vijoy Exp vijoy $ # # Cleanup and create input echo "Cleanup..." rm -rf Thumbs .input; mkdir Thumbs; rm -rf /tmp/.mogborder inputfile=`ls *.jpg *.JPG *++*` echo "Starting borders and thumbnailing..." for img in $inputfile do if [ ! -f $img ]; then break fi echo $img"..." # Copy images over and thumbnail them convert -geometry 160x160 -bordercolor black -border 3x3 $img Thumbs/$img # Build conversion file # First make it of uniform size (max width of 10") mogrify -geometry 720x720 $img # Get the original size and border it imgx=`identify $img|cut -d ' ' -f 3|cut -d '+' -f 1|cut -d 'x' -f 1` imgy=`identify $img|cut -d ' ' -f 3|cut -d '+' -f 1|cut -d 'x' -f 2` mogrify -border 8x10 -bordercolor black $img # Now label-ify if [ "X$1" != "X" ];then label="copyright_"$1 else label="copyright_vijoy_pandey" fi labellen=`expr \$label : '.*'` label=`echo $label| sed s/\_/\ /g` imgx=`identify $img|cut -d ' ' -f 3|cut -d '+' -f 1|cut -d 'x' -f 1` imgy=`identify $img|cut -d ' ' -f 3|cut -d '+' -f 1|cut -d 'x' -f 2` imgx=`expr $imgx - $labellen \* 6 - 5` imgy=`expr $imgy - 4` if [ $imgx -lt 0 ]; then imgx=0 fi drawopt="text $imgx,$imgy \"$label\"" echo "mogrify -fill white -font x:6x10 -draw '$drawopt' $img" \ >> /tmp/.mogborder done chmod +x /tmp/.mogborder /tmp/.mogborder rm -rf /tmp/.mogborder