mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Fixed handling rotated images
This commit is contained in:
parent
c066f803f1
commit
ba5bae0d1c
@ -45,3 +45,7 @@ VDR Plugin 'pictures' Revision History
|
|||||||
2011-02-20: Version 0.1.0
|
2011-02-20: Version 0.1.0
|
||||||
|
|
||||||
- Fixed reallocating memory (reported by Paul Menzel).
|
- Fixed reallocating memory (reported by Paul Menzel).
|
||||||
|
|
||||||
|
2011-07-23:
|
||||||
|
|
||||||
|
- Now rotating images according to the EXIF 'Orientation' parameter.
|
||||||
|
@ -7,13 +7,14 @@
|
|||||||
#
|
#
|
||||||
# See the README file for copyright information and how to reach the author.
|
# 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)
|
## TODO implement HDTV (1920 x 1080)
|
||||||
|
|
||||||
use File::Path;
|
use File::Path;
|
||||||
use File::Spec;
|
use File::Spec;
|
||||||
use Getopt::Std;
|
use Getopt::Std;
|
||||||
|
use Image::ExifTool qw(:Public);
|
||||||
use Image::Size;
|
use Image::Size;
|
||||||
|
|
||||||
$Usage = qq{
|
$Usage = qq{
|
||||||
@ -151,6 +152,15 @@ sub ConvertFile
|
|||||||
}
|
}
|
||||||
my ($w, $h) = imgsize($Pict);
|
my ($w, $h) = imgsize($Pict);
|
||||||
print "image size is $w x $h\n" if ($Detailed);
|
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) {
|
if ($w / $h <= $ScreenRatio) {
|
||||||
$w = $h * $ScreenRatio;
|
$w = $h * $ScreenRatio;
|
||||||
}
|
}
|
||||||
@ -161,8 +171,9 @@ sub ConvertFile
|
|||||||
my $ScaleH = $SH / $h * (100 - 2 * $OverscanY) / 100;
|
my $ScaleH = $SH / $h * (100 - 2 * $OverscanY) / 100;
|
||||||
$Pict = EscapeMeta($Pict);
|
$Pict = EscapeMeta($Pict);
|
||||||
$Mpeg = EscapeMeta($Mpeg);
|
$Mpeg = EscapeMeta($Mpeg);
|
||||||
print "$Pict -> $Mpeg\n" if $ListFiles;
|
print "$Pict -> $Mpeg $Rotate\n" if $ListFiles;
|
||||||
my $Cmd = "$PNMCONV{$Type} $Pict 2> /dev/null |"
|
my $Cmd = "$PNMCONV{$Type} $Pict 2> /dev/null |"
|
||||||
|
. "pamflip $verbose1 $Rotate |"
|
||||||
. "pnmscale $verbose1 --xscale=$ScaleW --yscale=$ScaleH |"
|
. "pnmscale $verbose1 --xscale=$ScaleW --yscale=$ScaleH |"
|
||||||
. "pnmpad $verbose1 --black --width $SW --height $SH |"
|
. "pnmpad $verbose1 --black --width $SW --height $SH |"
|
||||||
. "ppmntsc $verbose1 $system1 |"
|
. "ppmntsc $verbose1 $system1 |"
|
||||||
|
Loading…
Reference in New Issue
Block a user