Check out Image::Info. That module handles lots of image formats and provides a dim() function. Use it in list context to get both X and Y dimensions and then multiply for the number of pixels. This code is untested, but it should be as easy as:
use Image::Info; my $info = image_info($image_file); my ($x,$y) = dim($info); print "Total pixels: ", $x * $y, "\n";
-sauoq "My two cents aren't worth a dime.";
In reply to Re: pixel counting
by sauoq
in thread pixel counting
by redbeard
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |