Get width and height of the image with Imager getwidth, getheight

In Perl's image manipulation module Imager, use the getwidth and getheight methods to get the width and height.

# Get width
$imager->getwidth

# Get height
$imager->getheight;

Example

This is an example using getwidth and gettheight.

use Imager;
my $imager = Imager->new;
my $image_file = 'image.png';
$imager->read(file => $image_file);
my $width = $imager->getwidth;
my $height = $imager->getheight;

Related Informatrion