#!/home/ben/software/install/bin/perl
use warnings;
use strict;
use utf8;
use FindBin '$Bin';
use Image::PNG::Util ':all';
use Getopt::Long;

my %options;

my $ok = GetOptions (
    grayonly => \$options{grayonly},
    verbose => \$options{verbose},
);

for my $file (@ARGV) {
    my $out = rgb2gray ($file, %options);
    if ($out) {
	my $outname = $file;
	if ( ! ($outname =~ s!\.png!-gray.png!)) {
	    print "boo bloody hoo";
	    next;
	}
	$out->write_png_file ($outname);
    }
}


# Local variables:
# mode: perl
# End:
