[e88656]: tests / compareImages.pl  Maximize  Restore  History

Download this file

57 lines (36 with data), 1.2 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/perl
use File::Temp qw/ tempfile tempdir /;
use strict;
use Getopt::Long;
my ($uncrop1, $uncrop2,$verbose);
GetOptions( 'uncrop1' => \$uncrop1,
'uncrop2' => \$uncrop2,
'verbose' => \$verbose,
);
my $first = shift @ARGV;
my $second = shift @ARGV;
die "file not found [$first]" if (not -f $first);
die "file not found [$second]" if (not -f $second);
my ($fhTIFF, $tmp) = tempfile('tmpXXXX', {SUFFIX => 'tif', UNLINK => 1});
my ($fh, $tmp) = tempfile('tmpXXXX', {SUFFIX => 'png', UNLINK => 1});
my $output;
my $tmpFull1 = '';
my $tmpFull2 = '';
if ($uncrop1) {
my $tmp = "tmp$$";
$tmpFull1 = "tmp${$}0000.tif";
`PTuncrop -p $tmp -q $first`;
die "Unable to uncrop $first" if (not -f $tmpFull1);
$first = $tmpFull1;
}
if ($uncrop2) {
my $tmp = "tmpa${$}";
$tmpFull2 = "tmpa${$}0000.tif";
`PTuncrop -p $tmp -q $second`;
die "Unable to uncrop $second" if (not -f $tmpFull2);
$second = $tmpFull2;
}
$output = `compare -verbose -metric mae '$first' '$second' '$tmp' 2>&1`;
unlink $tmpFull1 if $tmpFull1 ne "";
unlink $tmpFull2 if $tmpFull2 ne "";
print $output;

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks