File: 020-autolevels.t

package info (click to toggle)
libimager-perl 1.019%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 6,824 kB
  • sloc: perl: 32,886; ansic: 28,193; makefile: 52; cpp: 4
file content (38 lines) | stat: -rw-r--r-- 1,130 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!perl -w
use strict;
use Imager;
use Test::More tests => 4;
use Imager::Test qw(is_image);

-d "testout" or mkdir "testout";

Imager->open_log(log => "testout/filters-autolev.log");

my $base = Imager->new(xsize => 10, ysize => 10);
$base->box(filled => 1, xmax => 4, color => "404040");
$base->box(filled => 1, xmin => 5, color => "C0C0C0");

{
  my $cmp = Imager->new(xsize => 10, ysize => 10);
  $cmp->box(filled => 1, xmax => 4, color => "#000");
  $cmp->box(filled => 1, xmin => 5, color => "#FFF");

  {
    my $work = $base->copy;
    #$work->write(file => "testout/autolevel-base.ppm");
    ok($work->filter(type => "autolevels"), "default autolevels");
    #$work->write(file => "testout/autolevel-filtered.ppm");
    #$cmp->write(file => "testout/autolevel-cmp.ppm");
    is_image($work, $cmp, "check we got expected image");
  }

  {
    my $work = $base->to_rgb_double;
    ok($work->filter(type => "autolevels"), "default autolevels (double)");
    is_image($work, $cmp, "check we got expected image");
    $work->write(file => "testout/autolevel-filtered.ppm", pnm_write_wide_data => 1);
  }
}


Imager->close_log;