use Image::Info qw(image_info dim); my $info = image_info("image.tif"); if (my $error = $info->{error}) { die "Can't open image file: $error\n"; } my $res = $info->{resolution}; print $res;