cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame^] | 1 | #!/usr/bin/perl |
| 2 | # |
| 3 | # Test writing TIFF images |
| 4 | # |
| 5 | # Contributed by Bob Friesenhahn <bfriesen@simple.dallas.tx.us> |
| 6 | # |
| 7 | BEGIN { $| = 1; $test=1; print "1..10\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/tiff' || die 'Cd failed'; |
| 16 | |
| 17 | # |
| 18 | # 1) Test 4-bit pseudocolor image |
| 19 | # |
| 20 | print("PseudoColor image (4 bits/sample) ...\n"); |
| 21 | testReadWrite( 'input_16.tiff', |
| 22 | 'output_16.tiff', |
| 23 | q//, |
| 24 | 'c33901f8a62814e6c2c1ecca0c7d1c95b3ecb089f4815ab630652e25cae85b44'); |
| 25 | |
| 26 | # |
| 27 | # 2) Test 8-bit pseudocolor image |
| 28 | # |
| 29 | ++$test; |
| 30 | print("PseudoColor image (8 bits/sample) ...\n"); |
| 31 | testReadWrite( 'input_256.tiff', |
| 32 | 'output_256.tiff', |
| 33 | q//, |
| 34 | '08fdfd88b1eb09649ef126c1fe5a8c5b958eb941653daa0b3615f1b9db9966df'); |
| 35 | |
| 36 | # |
| 37 | # 3) Test 4-bit pseudocolor + matte channel image |
| 38 | # |
| 39 | ++$test; |
| 40 | print("PseudoColor image (4 bits/sample + matte channel) ...\n"); |
| 41 | testReadWrite( 'input_16_matte.tiff', |
| 42 | 'output_16_matte.tiff', |
| 43 | q//, |
| 44 | 'c33901f8a62814e6c2c1ecca0c7d1c95b3ecb089f4815ab630652e25cae85b44' ); |
| 45 | |
| 46 | # |
| 47 | # 4) Test 8-bit pseudocolor + matte channel image |
| 48 | # |
| 49 | ++$test; |
| 50 | print("PseudoColor image (8 bits/sample + matte channel) ...\n"); |
| 51 | testReadWrite( 'input_256_matte.tiff', |
| 52 | 'output_256_matte.tiff', |
| 53 | q//, |
| 54 | 'f28f9d3620babcaf84c61ffbf3f92e83fcc0bc3d5904ac7b8a1318e8d796859f' ); |
| 55 | |
| 56 | # |
| 57 | # 5) Test truecolor image |
| 58 | # |
| 59 | ++$test; |
| 60 | print("TrueColor image (8 bits/sample) ...\n"); |
| 61 | testReadWrite( 'input_truecolor.tiff', |
| 62 | 'output_truecolor.tiff', |
| 63 | q/quality=>55/, |
| 64 | '4002f066656ca5cdb12afa067769bfa432b1d45d0278d1c558cf4a64638eaa6e' ); |
| 65 | |
| 66 | # |
| 67 | # 6) Test monochrome image |
| 68 | # |
| 69 | ++$test; |
| 70 | print("Gray image (1 bit per sample) ...\n"); |
| 71 | testReadWrite( 'input_mono.tiff', |
| 72 | 'output_mono.tiff', |
| 73 | q//, |
| 74 | '83175f7bcc43fb71212dee254c85e355c18bcd25f35d3b9caba66fff7341fa64' ); |
| 75 | |
| 76 | # |
| 77 | # 7) Test gray 4 bit image |
| 78 | # |
| 79 | ++$test; |
| 80 | print("Gray image (4 bits per sample) ...\n"); |
| 81 | testReadWrite( 'input_gray_4bit.tiff', |
| 82 | 'output_gray_4bit.tiff', |
| 83 | q//, |
| 84 | 'aff256464aeb39a8fd5498d7e296362a11b827f6700b7ad1342b8be8a6304303' ); |
| 85 | |
| 86 | # |
| 87 | # 8) Test gray 8 bit image |
| 88 | # |
| 89 | ++$test; |
| 90 | print("Gray image (8 bits per sample) ...\n"); |
| 91 | testReadWrite( 'input_gray_8bit.tiff', |
| 92 | 'output_gray_8bit.tiff', |
| 93 | q//, |
| 94 | '46542d79a23def43c94f4b07452e2d8466abd73a949569596d23bb7130b850f5' ); |
| 95 | |
| 96 | # |
| 97 | # 9) Test gray 4 bit image (with matte channel) |
| 98 | # |
| 99 | ++$test; |
| 100 | print("Gray image (4 bits per sample + matte channel) ...\n"); |
| 101 | testReadWrite( 'input_gray_4bit_matte.tiff', |
| 102 | 'output_gray_4bit_matte.tiff', |
| 103 | q//, |
| 104 | '91a3cb9734b88a1c35cfc439493115818d7f49a2fc7bcadec52b2489da0118f9' ); |
| 105 | |
| 106 | # |
| 107 | # 10) Test gray 8 bit image (with matte channel) |
| 108 | # |
| 109 | ++$test; |
| 110 | print("Gray image (8 bits per sample + matte channel) ...\n"); |
| 111 | testReadWrite( 'input_gray_8bit_matte.tiff', |
| 112 | 'output_gray_8bit_matte.tiff', |
| 113 | q//, |
| 114 | '49929da2adbe49c525a7e7f2210187ad496d14d0268c80cddcd201e389fe8171' ); |