Page 1 of 1

Posted: 2005-11-30T20:40:02-07:00
by anthony
I do that as part of a photo indexing script...

Code: Select all

rotation=`identify -format "%[EXIF:Orientation]" "$f"`

case "$rotation" in
  ""|"unknown") : no rotation supplied in image ;;
  1)  : normal camera rotation ;;
  6) rot="-rotate 90"  ;;
  8) rot="-rotate -90" ;;
  *) echo >&2 "Unknown rotation for  $f \"$rotation\"  -- Continuing" ;;
Now I include $rot in my IM command when generating a smaller 'web' version of the photo for generally viewing, and of course for its thumbnail.

Posted: 2005-11-30T21:41:38-07:00
by anthony
The script is a personal one, not appropriate for public consumption.

However once I get $rot (and extract comments from images) I use...

Code: Select all

    echo >&2 "Generating Smaller Image..."
    convert "$f" $rot -thumbnail ${nsize}x${nsize} -quality $nqual "$n"
where $f is the origina and $n is the new 'web' image
$nsize is set to 790 pixels.

The thumbnail image is basically as per the IM thumbnail examples...

Code: Select all

      angle=`perl -e 'srand();  print rand() * 20 - 10'`
      size=`convert "$n" -thumbnail ${tsize}x${tsize} \
          -bordercolor white  -border 6 \
          -bordercolor grey60 -border 1 \
          -background  none   -rotate $angle \
          -background  black  \( +clone -shadow 60x4+4+4 \) +swap \
          -background  none   -flatten \
          -depth 8 -colors 256 -quality 95 \
          -write "$t" -format "WIDTH=%w HEIGHT=%h" info:-`
thumbnail size is 100 pixels, and outputs a PNG image
If I want a simpler plain thumbnail (non-fancy) a GIF is used.
The images are only re-built if the source is newer, or a FORCE option is used.

The script then writes up the index.html with image comments, date, and generated thumbanil and so on.

Posted: 2006-05-17T20:27:08-07:00
by magick
Post a URL to 3-5 images that contain orientation information in the EXIF profile and we will look into supporting automatic rotation to the correct orientation.

Posted: 2006-05-21T18:42:36-07:00
by anthony
You forgot the orientation for upsidedown, camera looking straight up
and camera looking straight down :-)

I see these in my own camera when I take photos of documents (a quick way of scanning :-) or of kites and planes when I'm directly underneath. these situations do produce their own 'orentation' in many cameras.

Posted: 2006-06-28T23:04:56-07:00
by anthony
Yes the -auto-orient option as added due to your artical!

I thought you knew :-)