Mac::ScreenCapture - Capture screen, save it and compare with previous shots.
use Mac::ScreenCapture;
my $area = {x=> 0, y => 0, width => 100, height => 100};
{
my $image = Mac::ScreenCapture::CaptureArea ($area);
$image->WriteToFile ("Base.png");
}
# Later ....
my $image = Mac::ScreenCapture::LoadImage ("Base.png");
my $image2 = Mac::ScreenCapture::CaptureArea ($area);
$image2->WriteToFile ("Second.png");
if ($image->Equals ($image2)) {
print "Same thing\n" ;
} else {
my $difference = $image->ComputeDifference ($image2);
$difference->WriteToFile ("Difference.png");
}
This module contains functions for the following operations:
my $image = Mac::ScreenCapture::CaptureArea (
{x=>0, y=>0, width => 200, height => 200});
print "W:".$image->GetWidth()."\n";
print "H:".$image->GetHeight()."\n";
$image->WritToFile ("MyImage.png");
if ($image->Equals($other)) {
print "Equals";
}
my $diffimage = $image->ComputeDifference ($other);
The Mac::ScreenCapture modules were written by Miklos Fazekas <boga@mac.com>.
perl(1).