my $snapshot = new Image::Grab; $snapshot->ua->timeout(5); # define the timeout for grabbing an image. Default is 180 sec$ $snapshot-> url( "IPCamera{$key}"); #define the source of the image $snapshot->grab; #grab an image mark_blob(my $pic); $pic = $snapshot->image; #debug my $SaveFile = join("","$ImagePath{$key}",×tamp,"\-snapshot\-$key.jpg"); print ("Save filename: $SaveFile"); open(my $fh, ">$SaveFile") || die "$SaveFile: $!"; binmode $fh; # for MSDOS derivations. print $fh $pic; close $fh;