From c80b899f5277b31af90809ff9798fcfd4746df7a Mon Sep 17 00:00:00 2001 From: Jakub Steiner Date: Tue, 24 Jun 2008 12:18:55 +0200 Subject: Patch by Bailey Kong to support image autorotation and .jpg extension --- convert/imgconv | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/convert/imgconv b/convert/imgconv index 84a9bbc..396a786 100755 --- a/convert/imgconv +++ b/convert/imgconv @@ -11,6 +11,7 @@ #default options dir=./web-gallery zip=0 +rotate=0 mq=0 hq=0 interactive=0 @@ -26,15 +27,16 @@ gal_pass="" # convert options convertor=`which convert` +jhead=`which jhead` extra_ops="-strip" # This script name=`basename $0` # getopt stuff -shortopts="a:hHin:d:D:Mqo:Z" +shortopts="a:hHin:d:D:Mqo:Zr" longopts="author:quiet,help,interactive,name:,date:,description:,\ -mq,hq,output:,archive" +mq,hq,output:,archive,rotate" @@ -52,10 +54,11 @@ Convert FILEs -n, --name NAME set gallery's name -d, --date DATE set date to DATE -D, --description DESC description + -r, --rotate automatically rotate image based on EXIF -q, --quiet don't say anything -h, --help display this help and exit -FILEs must be JPEG or PNG. if DIR is not given, the +FILEs must be JPG, JPEG or PNG. if DIR is not given, the gallery will be created in $dir. EOF @@ -67,7 +70,7 @@ good_file() { ftype=`file -b "$1" | cut -d " " -f 1` - if [ "$ftype" == "JPEG" ] || [ "$ftype" == "PNG" ] + if [ "$ftype" == "JPG" ] || [ "$ftype" == "JPEG" ] || [ "$ftype" == "PNG" ] then return 0 else @@ -115,6 +118,9 @@ while true; do -Z|--zip) zip=1 ; shift ;; + -r|--rotate) + rotate=1 ; shift ;; + -q|--quiet) verbose=false ; shift ;; @@ -133,6 +139,15 @@ while true; do done + +# If we don't have JHead and we want to auto-rotate images, cry & exit +if [ $rotate -gt 0 ] && [ -z $jhead ]; then + echo "jhead not found... Please install JHead." + exit 1 +fi + + + # If no input files are given, display usage & exit if [ $# == 0 ]; then cat <