rename LICENSE to COPYING and add a more complete LICENSE file.
[rofl0r-openDOW.git] / utils / imgdiff-biggest.pl
blob92e10bbbf5923a7f10ff608e70c5d32a7221787a
1 #!/usr/bin/env perl
2 use strict;
3 use warnings;
5 use File::Basename;
6 use Cwd 'abs_path';
7 my $path = dirname(abs_path($0));
9 my $inp = shift @ARGV or die ("$0 template-image series-of-images");
10 my $x = 99999999999;
11 my $y = 99999999999;
12 my $wmax = -1;
13 my $hmax = -1;
14 my $biggest = "";
15 for(@ARGV) {
16 my $cmd = $path . "/imgdiff.out $inp $_ /tmp/__aaabbbbxxxx.png";
17 my $res = `$cmd`;
18 if($res =~ /(\d+),(\d+),(\d+),(\d+)/) {
19 my $xi = $1;
20 my $yi = $2;
21 my $wi = $3;
22 my $hi = $4;
23 if($xi < $x) {
24 $x = $xi;
25 $biggest = $_;
27 if($yi < $y) {
28 $y = $yi;
29 $biggest = $_;
31 if($wi > $wmax) {
32 $wmax = $wi;
33 $biggest = $_;
35 if($hi > $hmax) {
36 $hmax = $hi;
37 $biggest = $_;
42 print "biggest: $biggest : $x,$y,$wmax,$hmax\n";