Created
November 12, 2016 22:23
-
-
Save valchonedelchev/775929161186e00a1a163b5c1bda087f to your computer and use it in GitHub Desktop.
Get image orientation in Perl using Image::Magick
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Image::Magick; | |
sub get_image_orientation { | |
my $file = shift; | |
my $image = Image::Magick->new; | |
$image->Read($file); | |
my $w = $image->Get('width'); | |
my $h = $image->Get('height'); | |
return $w/$h > 1 ? 'horizontal' : 'vertical'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment