5 # actual benchmarking code for quantbench.pl - not intended to be used
12 # rgbtile and hsvgrad are both difficult images - they both have
13 # more than 256 colours
14 my $img = Imager->new;
15 $img->open(file=>'bench/rgbtile.png')
16 or die "Cannot load bench/rgbtile.png:",$img->errstr;
17 $imgs{rgbtile} = $img;
20 $img->open(file=>'bench/hsvgrad.png')
21 or die "Cannot load bench/hsvgrad.png:", $img->errstr;
22 $imgs{hsvgrad} = $img;
25 $img->open(file=>'bench/kscdisplay.png')
26 or die "Cannot load bench/kscdisplay.png:", $img->errstr;
27 $imgs{kscdisplay} = $img;
29 # I need some other images
30 for my $key (keys %imgs) {
31 for my $tran (qw(closest errdiff)) {
32 my $img = $imgs{$key};
33 print "** $key $tran\n";
37 $img->write(file=>out($out, $key, $tran, 'addi'), type=>'gif',
38 gifquant=>'gen', make_colors=>'addi',
40 or die "addi",$img->errstr;
43 $img->write(file=>out($out, $key, $tran, 'webmap'),
45 gifquant=>'gen', make_colors=>'webmap',
47 or die "webmap",$img->errstr;
50 $img->write(file=>out($out, $key, $tran, 'mono'), type=>'gif',
51 gifquant=>'gen', make_colors=>'none',
52 colors=>[Imager::Color->new(0,0,0),
53 Imager::Color->new(255,255,255) ],
55 or die "mono",$img->errstr;
62 my ($out, $in, $tran, $pal) = @_;
63 $out or return '/dev/null';
64 return "bench/${out}_${in}_${tran}_$pal.gif";
71 quantone.perl - benchmarks image quantization with various options
76 perl bench/quantone.perl
77 # produce output images too
78 perl bench/quantone.perl prefix
82 Benchmarks image quantization on some test images, and with various
85 The current images are 2 synthesized images (rgbtile.png and
86 hsvgrad.png), and a cropped photo (kscdisplay.png).
88 This program is designed to be run by L<quantbench.perl>.