add new comparison method rgb_difference that resembles arithmetical difference per...
[imager.git] / bench / makegrad.perl
CommitLineData
02d1d628
AMH
1#!perl -w
2use Imager;
3
4=head1 NAME
5
6makegrad.perl - builds a large gradient image for quant.c benchmarking
7
8=head1 SYNOPSIS
9
10 perl makegrad.perl
11
12=cut
13
14# a trans2 script to produce our pretty graduation
15my $hsv = <<'EOS';
16y cy - x cx - atan2 pi / 180 * !hue
171 1 x cx / y cy / distance !sat
18@hue @sat 1 hsv
19EOS
20
21my $img = Imager::transform2({rpnexpr=>$hsv, width=>600, height=>600})
22 or die "transform2 failed: $Imager::ERRSTR";
23
24$img->write(file=>'hsvgrad.png', type=>'png')
25 or die "Write to hsvgrad.png failed: ", $img->errstr;
26
27# trans2 code to produce RGB tiles
28my $rgb = <<'EOS';
298 !tilesper
30w @tilesper / !tilex
31h @tilesper / !tiley
32x @tilex % @tilex / 255 * !red
33y @tiley % @tiley / 255 * !green
34x @tilex / int
35y @tiley / int @tilesper * + @tilesper @tilesper * / 255 * !blue
36@red @green @blue rgb
37EOS
38$img = Imager::transform2({rpnexpr=>$rgb, width=>600, height=>600})
39 or die "transform2 failed: $Imager::ERRSTR";
40$img->write(file=>'rgbtile.png', type=>'png')
41 or die "write to rgbtile failed: ",$img->errstr;