Home | History | Annotate | Download | only in png
      1 #!/usr/bin/perl
      2 #
      3 # Test writing PNG images
      4 #
      5 # Contributed by Bob Friesenhahn <bfriesen (at] simple.dallas.tx.us>
      6 #
      7 BEGIN { $| = 1; $test=1; print "1..6\n"; }
      8 END {print "not ok $test\n" unless $loaded;}
      9 
     10 use Image::Magick;
     11 $loaded=1;
     12 
     13 require 't/subroutines.pl';
     14 
     15 chdir 't/png' || die 'Cd failed';
     16 
     17 #
     18 # 1) Test Black-and-white, bit_depth=1 PNG
     19 # 
     20 print( "1-bit grayscale PNG ...\n" );
     21 testReadWrite( 'input_bw.png', 'output_bw.png', q/quality=>95/,
     22   '5a5b600153abaaf82dc9086272d01bedc4201d14b614c18cb4e9c6d1581c9023');
     23 
     24 #
     25 # 2) Test monochrome image
     26 #
     27 ++$test;
     28 print( "8-bit grayscale PNG ...\n" );
     29 testReadWrite( 'input_mono.png',
     30   'output_mono.png', '',
     31   'a8d79029f6ced36f904659dda5ea67a6bab5e602b1033aa29c7f1b45b35c1178');
     32 #
     33 # 3) Test 16-bit Portable Network Graphics
     34 # 
     35 ++$test;
     36 print( "16-bit grayscale PNG ...\n" );
     37 testReadWrite( 'input_16.png',
     38   'output_16.png',
     39   q/quality=>55/,
     40   'd4bed86abb1849f69f1a5afb7c5cf8798e8192ba228357f189c277198c14f5a0',
     41   '4036b56c00d731a2865470815eabc177dc158af2abacb34ef95c7e716ec2da60' );
     42 #
     43 # 4) Test pseudocolor image
     44 #
     45 ++$test;
     46 print( "8-bit indexed-color PNG ...\n" );
     47 testReadWrite( 'input_256.png',
     48   'output_256.png',
     49   q/quality=>54/,
     50   '26687d6be46b4e1ca5201a47caa7dad660245c5f4517835ab6e19f2f84fc4a03' );
     51 #
     52 # 5) Test truecolor image
     53 #
     54 ++$test;
     55 print( "24-bit Truecolor PNG ...\n" );
     56 testReadWrite( 'input_truecolor.png',
     57   'output_truecolor.png',
     58   q/quality=>55/,
     59   '76f43f03e51c8608bfca7ff96d3936148ad855782968a017ea03cccbeebff64d' );
     60 #
     61 # 6) Test Multiple-image Network Graphics
     62 #
     63 ++$test;
     64 print( "MNG with 24-bit Truecolor PNGs ...\n" );
     65 testReadWrite( 'input.mng',
     66   'output.mng',
     67   q/quality=>55/,
     68   '5a883e67c29d7bb27897ec7a3f3cb3fb0330fb43aef4360e8314503cb37fae09' );
     69