| 1 |
#!perl -w |
| 2 |
use strict; |
| 3 |
use Imager; |
| 4 |
use Test::More tests => 4; |
| 5 |
use Imager::Test qw(is_image); |
| 6 |
|
| 7 |
-d "testout" or mkdir "testout"; |
| 8 |
|
| 9 |
Imager->open_log(log => "testout/filters-autolev.log"); |
| 10 |
|
| 11 |
my $base = Imager->new(xsize => 10, ysize => 10); |
| 12 |
$base->box(filled => 1, xmax => 4, color => "404040"); |
| 13 |
$base->box(filled => 1, xmin => 5, color => "C0C0C0"); |
| 14 |
|
| 15 |
{ |
| 16 |
my $cmp = Imager->new(xsize => 10, ysize => 10); |
| 17 |
$cmp->box(filled => 1, xmax => 4, color => "#000"); |
| 18 |
$cmp->box(filled => 1, xmin => 5, color => "#FFF"); |
| 19 |
|
| 20 |
{ |
| 21 |
my $work = $base->copy; |
| 22 |
#$work->write(file => "testout/autolevel-base.ppm"); |
| 23 |
ok($work->filter(type => "autolevels"), "default autolevels"); |
| 24 |
#$work->write(file => "testout/autolevel-filtered.ppm"); |
| 25 |
#$cmp->write(file => "testout/autolevel-cmp.ppm"); |
| 26 |
is_image($work, $cmp, "check we got expected image"); |
| 27 |
} |
| 28 |
|
| 29 |
{ |
| 30 |
my $work = $base->to_rgb_double; |
| 31 |
ok($work->filter(type => "autolevels"), "default autolevels (double)"); |
| 32 |
is_image($work, $cmp, "check we got expected image"); |
| 33 |
$work->write(file => "testout/autolevel-filtered.ppm", pnm_write_wide_data => 1); |
| 34 |
} |
| 35 |
} |
| 36 |
|
| 37 |
|
| 38 |
Imager->close_log; |