すみません、
実際に使うにはこうしても無理みたいですが、
どうすれば・・・
#!/www/Perl/bin/perl

$png = "sample.png";
open(PNG,"$png");
read(PNG, $_, 24);
$_ =~ /\A\x89PNG\r\n\x1a\n/ or die;
($w, $h) = unpack("@16 N2", $_);
close(PNG);

print "Content-type : text/html; charset=shift-jis\n\n";#
print "<html>\n<body>\n<br><b>$w, $h</b><br>\n</body>\n</html>";

exit;