#!/bin/bash # Process menu scans for menus.fivegeeks.net. # This will look for menus called "X-1.jpg", "X-2.jpg" in the current # directory, and join them into an image called "X.jpg". Portrait images are # stacked left-to-right; landscape images top-to-bottom. # Adam Sampson norm="cat" # norm="pnmnorm -wvalue=255 -bvalue=80" for x in *-*1.jpg; do n=`basename $x .jpg | sed 's,-[^-]*$,,'` if [ `identify $x | perl -ne '/(\d+)x(\d+)/; if ($1 > $2) { print "down" } else { print "across" }'` = down ]; then join="pnmcat -topbottom" scale="-width" else join="pnmcat -leftright" scale="-height" fi if [ -e "$n.jpg" ]; then continue fi comment="Menu image from http://menus.fivegeeks.net/ processed by Adam Sampson ; date: `date +%Y-%m-%d`; sources:" echo "Merging to $n:" $n-*.jpg for y in $n-*.jpg; do join="$join <(anytopnm $y)" comment="$comment $y" done eval "$join" | pnmscale $scale 1400 | $norm | pnmtojpeg -quality 90 -comment "$comment" >$n.jpg done