4 init_log("testout/t105gif.log",1);
6 $green=i_color_new(0,255,0,255);
7 $blue=i_color_new(0,0,255,255);
8 $red=i_color_new(255,0,0,255);
10 $img=Imager::ImgRaw::new(150,150,3);
12 i_box_filled($img,70,25,130,125,$green);
13 i_box_filled($img,20,25,80,125,$blue);
14 i_arc($img,75,75,30,0,361,$red);
15 i_conv($img,[0.1, 0.2, 0.4, 0.2, 0.1]);
17 my $timg = Imager::ImgRaw::new(20, 20, 4);
18 my $trans = i_color_new(255, 0, 0, 127);
19 i_box_filled($timg, 0, 0, 20, 20, $green);
20 i_box_filled($timg, 2, 2, 18, 18, $trans);
22 if (!i_has_format("tiff")) {
23 print "ok 1 # skip no tiff support\n";
24 print "ok 2 # skip no tiff support\n";
25 print "ok 3 # skip no tiff support\n";
27 open(FH,">testout/t10.tiff") || die "cannot open testout/t10.tiff for writing\n";
29 my $IO = Imager::io_new_fd(fileno(FH));
30 i_writetiff_wiol($img, $IO);
35 open(FH,"testout/t10.tiff") or die "cannot open testout/t10.tiff\n";
37 $IO = Imager::io_new_fd(fileno(FH));
38 $cmpimg = i_readtiff_wiol($IO, -1);
42 print "# tiff average mean square pixel difference: ",sqrt(i_img_diff($img,$cmpimg))/150*150,"\n";
45 $IO = Imager::io_new_bufchain();
47 Imager::i_writetiff_wiol($img, $IO) or die "Cannot write to bufferchain\n";
48 my $tiffdata = Imager::io_slurp($IO);
50 open(FH,"testout/t10.tiff");
56 if ($odata eq $tiffdata) {
62 # test Micksa's tiff writer
64 my $faximg = Imager::ImgRaw::new(1728, 2000, 1);
65 my $black = i_color_new(0,0,0,255);
66 my $white = i_color_new(255,255,255,255);
67 # vaguely test-patterny
68 i_box_filled($faximg, 0, 0, 1728, 2000, $white);
69 i_box_filled($faximg, 100,100,1628, 200, $black);
72 while ($width+$pos < 1628) {
73 i_box_filled($faximg, $pos, 300, $pos+$width-1, 400, $black);
77 open FH, "> testout/t106tiff_fax.tiff"
78 or die "Cannot create testout/t106tiff_fax.tiff: $!";
80 $IO = Imager::io_new_fd(fileno(FH));
81 i_writetiff_wiol_faxable($faximg, $IO)