summaryrefslogtreecommitdiff
path: root/PLUGINS/src
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2011-07-23 14:29:18 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2011-07-23 14:29:18 +0200
commitba5bae0d1c643fb824d355704471b156bd184469 (patch)
tree4c7f2d8d3a59cecc352df8c9b88388fb422cb89d /PLUGINS/src
parentc066f803f10090239b76c6e1a2fcf8daa31c3f8a (diff)
downloadvdr-ba5bae0d1c643fb824d355704471b156bd184469.tar.gz
vdr-ba5bae0d1c643fb824d355704471b156bd184469.tar.bz2
Fixed handling rotated images
Diffstat (limited to 'PLUGINS/src')
-rw-r--r--PLUGINS/src/pictures/HISTORY4
-rwxr-xr-xPLUGINS/src/pictures/pic2mpg15
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 |"