diff options
| -rw-r--r-- | PLUGINS/src/pictures/HISTORY | 4 | ||||
| -rwxr-xr-x | PLUGINS/src/pictures/pic2mpg | 15 | 
2 files changed, 17 insertions, 2 deletions
| diff --git a/PLUGINS/src/pictures/HISTORY b/PLUGINS/src/pictures/HISTORY index 57290bc5..b67bbaca 100644 --- a/PLUGINS/src/pictures/HISTORY +++ b/PLUGINS/src/pictures/HISTORY @@ -45,3 +45,7 @@ VDR Plugin 'pictures' Revision History  2011-02-20: Version 0.1.0  - Fixed reallocating memory (reported by Paul Menzel). + +2011-07-23: + +- Now rotating images according to the EXIF 'Orientation' parameter. diff --git a/PLUGINS/src/pictures/pic2mpg b/PLUGINS/src/pictures/pic2mpg index af58f975..6213091e 100755 --- a/PLUGINS/src/pictures/pic2mpg +++ b/PLUGINS/src/pictures/pic2mpg @@ -7,13 +7,14 @@  #  # See the README file for copyright information and how to reach the author.  # -# $Id: pic2mpg 1.4 2008/02/29 14:34:22 kls Exp $ +# $Id: pic2mpg 2.1 2011/07/23 14:23:59 kls Exp $  ## TODO implement HDTV (1920 x 1080)  use File::Path;  use File::Spec;  use Getopt::Std; +use Image::ExifTool qw(:Public);  use Image::Size;  $Usage = qq{ @@ -151,6 +152,15 @@ sub ConvertFile       }    my ($w, $h) = imgsize($Pict);    print "image size is $w x $h\n" if ($Detailed); +  my $Exif = ImageInfo($Pict); +  my $Orientation = $$Exif{"Orientation"}; +  my ($Degrees) = $Orientation =~ /Rotate ([0-9]+) /;  +  my $Rotate = "-null"; +  $Rotate = "-cw"   if $Degrees eq "90"; +  $Rotate = "-ccw"  if $Degrees eq "270"; +  $Rotate = "-r180" if $Degrees eq "180"; +  print "orientation = '$Orientation' -> rotation = $Rotate\n" if ($Detailed); +  ($w, $h) = ($h, $w) if ($Degrees eq "90" || $Degrees eq "270");    if ($w / $h <= $ScreenRatio) {       $w = $h * $ScreenRatio;       } @@ -161,8 +171,9 @@ sub ConvertFile    my $ScaleH = $SH / $h * (100 - 2 * $OverscanY) / 100;    $Pict = EscapeMeta($Pict);    $Mpeg = EscapeMeta($Mpeg); -  print "$Pict -> $Mpeg\n" if $ListFiles; +  print "$Pict -> $Mpeg $Rotate\n" if $ListFiles;    my $Cmd = "$PNMCONV{$Type} $Pict 2> /dev/null |" +          . "pamflip $verbose1 $Rotate |"            . "pnmscale $verbose1 --xscale=$ScaleW --yscale=$ScaleH |"            . "pnmpad $verbose1 --black --width $SW --height $SH |"            . "ppmntsc $verbose1 $system1 |" | 
