This EXIF data is also available with the utility jhead.
If you're running debian:
apt-get install jhead
http://www.sentex.net/~mwandel/jhead/
I use it with jpegtran to rotate images based on their orientation.
apt-get install libjpeg-progs
http://jpegclub.org/
Excerpt from photo organization script, based at one point on Gerald's
that makes thumbnails, index file and other html pages for medium
view, etc.
http://impressive.net/software/photo/source/
for i in `ls *jpg`; do
jhead $i | egrep -q '^Orientation' && orientator $i
done
I split the orientation out into orientator script:
#!/bin/sh -x
filename=$1
cp $filename $filename.EGP
echo "rotating $filename"
jpegtran -rotate `jhead $filename | grep 'Orientation' | sed -e \
's/.*rotate //'` $filename.EGP > $filename
So this will rotate 90, 180 or 270 degrees as needed.
I also started displaying jhead data, exposure, aperture, date etc. on
my photo pages.
I was doing so at first with Server Side Includes but decided to make
it static.
SSI approach excerpt:
echo "<pre><!--#exec cmd=\"echo \$DOCUMENT_NAME | sed -e \
's/shtml/jpg/' | xargs /usr/bin/jhead\" --></pre><!--#include \
virtual=\"/include/footer\" -->" >> $i-med.shtml
static:
echo "<pre>`jhead $i.jpg`</pre><!--#include \
virtual=\"/include/footer\" -->" >> $i-med.shtml
There are some addons for generating xml of jhead data. It would be
pretty simple to generate xhtml or other output from this util but I
haven't bothered yet. I might one day adopt one of the rdf and xhtml
solutions for my photos from others on this list.
--
Ted Guild <
[email protected]>
http://www.guilds.net