# ImgSum.pm package ImgSum; use strict; use warnings; use Image::Magick; sub summary { my ($imgf, $res) = @_; my $img = new Image::Magick; $img->Read($imgf); my ($w, $h) = $img->Get(qw/rows columns/); my @sum; my $i = 0; for (my $y = 0; $y < $h; $y += $res) { for (my $x = 0; $x < $w; $x += $res) { my $px = $img->Get("pixel[$x,$y]"); my $rgb = [split/,/, $px]; $sum[$i++] = $rgb; } } return \@sum; } 1;