Skip to content

Instantly share code, notes, and snippets.

@valchonedelchev
Created November 12, 2016 22:23
Show Gist options
  • Save valchonedelchev/775929161186e00a1a163b5c1bda087f to your computer and use it in GitHub Desktop.
Save valchonedelchev/775929161186e00a1a163b5c1bda087f to your computer and use it in GitHub Desktop.
Get image orientation in Perl using Image::Magick
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