palpic2png.c: improve, make usable with ppic binary files
[rofl0r-openDOW.git] / utils / extract-sprites.pl
blob8d570ab16933b68572f532fc5af3b525cdd2a424
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));
8 my $dim = shift @ARGV;
9 my $dimstr;
11 sub syntax {
12 die("$0 -dim=x,y,w,h outfile%.2d.png blank-pic series-of-pics-to-be-diffed");
15 if ($dim =~ /-dim=(\d+),(\d+),(\d+),(\d+)/) {
16 } else {
17 syntax();
19 my $name = shift @ARGV;
20 syntax() unless $name =~ /%.*d/;
21 my $inp = shift @ARGV;
22 my $x = 0;
23 for(@ARGV) {
24 my $cmd = sprintf $path . "/imgdiff.out $dim $inp $_ $name", $x;
25 my $res = `$cmd`;
26 $x++;