use Win32::IE::Mechanize;
use Time::HiRes;
$ie = Win32::IE::Mechanize->new( visible => 1 ) ;
$ie->get( 'http://localhost/image/myimage.php' ) ;
while($ie->{agent}->Document->readyState !~ /complete/i){ sleep(0.1); }
$content = $ie->content;
save_image($content);
sub save_image {
my ($content) = @_;
open my $out_fh, ">", "image.png" or die $!;
binmode $out_fh;
print $out_fh $content;
close $out_fh;
}
####
####
####