#!/bin/bash # picseq - Generate a series of pictures from an original image # thumbnailGeometry="200x100" # The > below means only resize if the original is LARGER than this webGeometry="900x700>" outHtml="$(date +%Y%m%d.%H%M%S).html" if [ "$#" -eq "0" ] then echo " picseq " echo "" echo " picseq takes images (leaving the original" echo " alone) and generates two jpgs, one ${webGeometry} max" echo " for web display, and another ${thumbnailGeometry} max for a web thumbnail." echo " It also generates an HTML file index linking the two." echo "" exit fi echo " ${outHtml} Image Thumbnail Gallery

${outHtml} Image Thumbnail Gallery

" > ${outHtml} echo "$# images to process." while [ "$1x" != "x" ] do pic="$1" imgName="${pic%.*}" extension="${pic##*.}" # "convert" leaves the original alone: if [ ${extension} = "jpg" ] || [ ${extension} = "jpeg" ] then echo -n "." else convert ${pic} ${imgName}.jpg echo -n "." fi # Make copies, because mogrify overwrites the original: cp ${imgName}.jpg ${imgName}.web.jpg mv ${imgName}.jpg ${imgName}.thumb.jpg mogrify -geometry ${webGeometry} ${imgName}.web.jpg mogrify -geometry ${thumbnailGeometry} ${imgName}.thumb.jpg echo "" >> ${outHtml} shift done echo " " >> ${outHtml} echo "Index file is ${outHtml}."