Image-ExifTool - Re: Detecting Orientation

Posted on Sun Aug 24 17:36:29 2008 by knighthawk in response to 8661 (See the whole thread of 6)
Re: Detecting Orientation
Hi Phil, thanks for looking into it. I still am facing issues, so I decided to test it out. I clicked four photos today with rotation 0, 90, 180 and 270 CW. I'm using Ubuntu 8.04, and the OS automatically rotated the 90, and 270 images while displaying (but if previewed when uploading to a Website, I get to see the original orientation). The 180 degree image, on the other hand was left as is.
Problem 1: When I ran exiftool with the -n option, the 180 degree image returned the Orientation option as "1" instead of a "3".
Problem 2: I got the following error when I ran the script:
Use of uninitialized value in hash element at jpegtran.plx line 18. Use of uninitialized value in concatenation (.) or string at jpegtran.plx line 18.
Problem 3: How do I handle the option "1" (default, no rotate)
Sorry to ask again, I'm a novice to Perl. I have listed the code below.
#! usr/bin/perl use strict; use warnings; use Image::ExifTool qw(:Public); my $exifTool = new Image::ExifTool; my %rot_args = ( 2 => '-flip horizontal', 3 => '-rotate 180', 4 => '-flip vertical', 5 => '-transpose', 6 => '-rotate 90', 7 => '-transverse', 8 => '-rotate 270' ); my $rotation = $exifTool->GetValue('Orientation', 'ValueConv'); my $command = "jpegtran -copy all $rot_args{$rotation} IMG_7885.JPG > IMG_7885_2.JPG"; exec($command);
Direct Responses: 8666 | Write a response