Imagerで画像の幅と高さとを取得する getwidth, getheight

 Perlの画像操作モジュールImagerで、幅と高さとを取得するには、getwidthメソッドとgetheightメソッドを使用します。

# 幅の取得
$imager->getwidth

# 高さの取得
$imager->getheight;

サンプル

 getwidthとgetheightを使用したサンプルです。

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