| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1 | #!/usr/bin/perl |
| cristy | 1454be7 | 2011-12-19 01:52:48 +0000 | [diff] [blame] | 2 | # Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3 | # dedicated to making software imaging solutions freely available. |
| 4 | # |
| 5 | # You may not use this file except in compliance with the License. You may |
| 6 | # obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.imagemagick.org/script/license.php |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # |
| 16 | # Test writing formats supported directly by ImageMagick |
| 17 | # |
| 18 | |
| 19 | BEGIN { $| = 1; $test=1; print "1..32\n"; } |
| 20 | END {print "not ok $test\n" unless $loaded;} |
| 21 | use Image::Magick; |
| 22 | $loaded=1; |
| 23 | |
| 24 | require 't/subroutines.pl'; |
| 25 | |
| 26 | chdir 't' || die 'Cd failed'; |
| 27 | |
| 28 | print("AVS X image file ...\n"); |
| 29 | testReadWrite( 'AVS:input.avs', |
| 30 | 'AVS:output.avs', |
| 31 | q//, |
| cristy | d2cb5a9 | 2011-12-31 20:10:15 +0000 | [diff] [blame] | 32 | 'e7d406ec41fe69ba2bd88dd59e5eb17a83f17c0a99519def02c020041144f5b3'); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 33 | |
| 34 | print("Microsoft Windows bitmap image file ...\n"); |
| 35 | ++$test; |
| 36 | testReadWrite( 'BMP:input.bmp', |
| 37 | 'BMP:output.bmp', |
| 38 | q//, |
| cristy | 18139f0 | 2012-03-11 17:51:02 +0000 | [diff] [blame^] | 39 | '4db1c9f8cf10c1a9a7e80397b4cf060d2d31caae13ba712712e6341fb96bd6b0', |
| cristy | d2cb5a9 | 2011-12-31 20:10:15 +0000 | [diff] [blame] | 40 | 'ae2007d0e05933a72294a6f8c7b59fc54d5fa3039f0f13bf8d65d05044ef2f39'); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 41 | |
| 42 | print("Microsoft Windows 24-bit bitmap image file ...\n"); |
| 43 | ++$test; |
| 44 | testReadWrite( 'BMP:input.bmp24', |
| 45 | 'BMP:output.bmp24', |
| 46 | q//, |
| cristy | 11165b7 | 2011-09-28 17:26:49 +0000 | [diff] [blame] | 47 | '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33'); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 48 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 49 | print("ZSoft IBM PC multi-page Paintbrush file ...\n"); |
| 50 | ++$test; |
| 51 | testReadWrite( 'DCX:input.dcx', |
| 52 | 'DCX:output.dcx', |
| 53 | q//, |
| cristy | 11165b7 | 2011-09-28 17:26:49 +0000 | [diff] [blame] | 54 | '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33'); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 55 | |
| 56 | print("Microsoft Windows 3.X DIB file ...\n"); |
| 57 | ++$test; |
| 58 | testReadWrite( 'DIB:input.dib', |
| 59 | 'DIB:output.dib', |
| 60 | q//, |
| cristy | 11165b7 | 2011-09-28 17:26:49 +0000 | [diff] [blame] | 61 | '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33'); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 62 | |
| 63 | print("Flexible Image Transport System ...\n"); |
| 64 | ++$test; |
| 65 | testReadWrite( 'FITS:input.fits', |
| 66 | 'FITS:output.fits', |
| 67 | q//, |
| cristy | b241f38 | 2012-01-01 01:45:57 +0000 | [diff] [blame] | 68 | '04b3cafea6030665fbedcc3463711475bcda2ad35254e5a632d8772905f59ab9' ); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 69 | |
| 70 | print("CompuServe graphics interchange format ...\n"); |
| 71 | ++$test; |
| 72 | testReadWrite( 'GIF:input.gif', |
| 73 | 'GIF:output.gif', |
| 74 | q//, |
| cristy | 18139f0 | 2012-03-11 17:51:02 +0000 | [diff] [blame^] | 75 | '4db1c9f8cf10c1a9a7e80397b4cf060d2d31caae13ba712712e6341fb96bd6b0', |
| cristy | d2cb5a9 | 2011-12-31 20:10:15 +0000 | [diff] [blame] | 76 | 'ae2007d0e05933a72294a6f8c7b59fc54d5fa3039f0f13bf8d65d05044ef2f39'); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 77 | |
| 78 | print("CompuServe graphics interchange format (1987) ...\n"); |
| 79 | ++$test; |
| 80 | testReadWrite( 'GIF87:input.gif87', |
| 81 | 'GIF87:output.gif87', |
| 82 | q//, |
| cristy | 18139f0 | 2012-03-11 17:51:02 +0000 | [diff] [blame^] | 83 | 'a06fe5ec382d10ef6dce8d2bd729c4a57c66d82ed695e2786f1d1f280aaa17fb', |
| cristy | d2cb5a9 | 2011-12-31 20:10:15 +0000 | [diff] [blame] | 84 | 'a037bce490abf358b3c8e1f471a83d15434da26d6c91aa6d761407c0df573f1d'); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 85 | |
| 86 | print("Magick image file format ...\n"); |
| 87 | ++$test; |
| 88 | testReadWrite( 'MIFF:input.miff', |
| 89 | 'MIFF:output.miff', |
| 90 | q//, |
| cristy | 11165b7 | 2011-09-28 17:26:49 +0000 | [diff] [blame] | 91 | '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33'); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 92 | |
| 93 | print("MTV Raytracing image format ...\n"); |
| 94 | ++$test; |
| 95 | testReadWrite( 'MTV:input.mtv', |
| 96 | 'MTV:output.mtv', |
| 97 | q//, |
| cristy | 11165b7 | 2011-09-28 17:26:49 +0000 | [diff] [blame] | 98 | '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33'); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 99 | |
| 100 | print("Portable bitmap format (black and white), ASCII format ...\n"); |
| 101 | ++$test; |
| 102 | testReadWrite( 'PBM:input_p1.pbm', |
| 103 | 'PBM:output_p1.pbm', |
| 104 | q/compression=>'None'/, |
| cristy | b241f38 | 2012-01-01 01:45:57 +0000 | [diff] [blame] | 105 | 'c8c4f812d902693d1de6c74a6cffaaef7506bd868df65cae63b06707f2c9f3ac'); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 106 | |
| 107 | print("Portable bitmap format (black and white), binary format ...\n"); |
| 108 | ++$test; |
| 109 | testReadWrite( 'PBM:input_p4.pbm', |
| 110 | 'PBM:output_p4.pbm', |
| 111 | q//, |
| cristy | b241f38 | 2012-01-01 01:45:57 +0000 | [diff] [blame] | 112 | 'c8c4f812d902693d1de6c74a6cffaaef7506bd868df65cae63b06707f2c9f3ac'); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 113 | |
| 114 | print("ZSoft IBM PC Paintbrush file ...\n"); |
| 115 | ++$test; |
| 116 | testReadWrite( 'PCX:input.pcx', |
| 117 | 'PCX:output.pcx', |
| 118 | q//, |
| cristy | 11165b7 | 2011-09-28 17:26:49 +0000 | [diff] [blame] | 119 | '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33'); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 120 | |
| 121 | print("Portable graymap format (gray scale), ASCII format ...\n"); |
| 122 | ++$test; |
| 123 | testReadWrite( 'PGM:input_p2.pgm', |
| 124 | 'PGM:output_p2.pgm', |
| 125 | q/compression=>'None'/, |
| cristy | b241f38 | 2012-01-01 01:45:57 +0000 | [diff] [blame] | 126 | 'a52f1015dcd3290c136b892874b0ef06516d28a846a2a7383d896267a5299aba'); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 127 | |
| 128 | print("Apple Macintosh QuickDraw/PICT file ...\n"); |
| 129 | ++$test; |
| 130 | testReadWrite( 'PICT:input.pict', |
| 131 | 'PICT:output.pict', |
| 132 | q//, |
| cristy | f09d1a4 | 2012-01-11 19:40:23 +0000 | [diff] [blame] | 133 | '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33'); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 134 | |
| 135 | print("Portable pixmap format (color), ASCII format ...\n"); |
| 136 | ++$test; |
| 137 | testReadWrite( 'PPM:input_p3.ppm', |
| 138 | 'PPM:output_p3.ppm', |
| 139 | q/compression=>'None'/, |
| cristy | 11165b7 | 2011-09-28 17:26:49 +0000 | [diff] [blame] | 140 | '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33'); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 141 | |
| 142 | print("Portable graymap format (gray scale), binary format ...\n"); |
| 143 | ++$test; |
| 144 | testReadWrite( 'PGM:input_p5.pgm', |
| 145 | 'PGM:output_p5.pgm', |
| 146 | q//, |
| cristy | b241f38 | 2012-01-01 01:45:57 +0000 | [diff] [blame] | 147 | 'a52f1015dcd3290c136b892874b0ef06516d28a846a2a7383d896267a5299aba'); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 148 | |
| 149 | print("Portable pixmap format (color), binary format ...\n"); |
| 150 | ++$test; |
| 151 | testReadWrite( 'PPM:input_p6.ppm', |
| 152 | 'PPM:output_p6.ppm', |
| 153 | q//, |
| cristy | 11165b7 | 2011-09-28 17:26:49 +0000 | [diff] [blame] | 154 | '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33'); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 155 | |
| 156 | print("Adobe Photoshop bitmap file ...\n"); |
| 157 | ++$test; |
| 158 | testReadWrite( 'PSD:input.psd', |
| 159 | 'PSD:output.psd', |
| 160 | q//, |
| cristy | 11165b7 | 2011-09-28 17:26:49 +0000 | [diff] [blame] | 161 | '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33' ); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 162 | |
| 163 | print("Irix RGB image file ...\n"); |
| 164 | ++$test; |
| 165 | testReadWrite( 'SGI:input.sgi', |
| 166 | 'SGI:output.sgi', |
| 167 | q//, |
| cristy | 11165b7 | 2011-09-28 17:26:49 +0000 | [diff] [blame] | 168 | '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33'); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 169 | |
| 170 | print("SUN 1-bit Rasterfile ...\n"); |
| 171 | ++$test; |
| 172 | testReadWrite( 'SUN:input.im1', |
| 173 | 'SUN:output.im1', |
| 174 | q//, |
| cristy | d2cb5a9 | 2011-12-31 20:10:15 +0000 | [diff] [blame] | 175 | 'cf6e645339d1bb82131ad658f2e7521f1e8aac69eb6e7add728f6157489972cd'); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 176 | |
| 177 | print("SUN 8-bit Rasterfile ...\n"); |
| 178 | ++$test; |
| 179 | testReadWrite( 'SUN:input.im8', |
| 180 | 'SUN:output.im8', |
| 181 | q//, |
| cristy | 18139f0 | 2012-03-11 17:51:02 +0000 | [diff] [blame^] | 182 | 'a4c13fd97d6b9b32c016793d6ae2b01cee048b5f2790de8daaacccdf1c4b6956', |
| cristy | d2cb5a9 | 2011-12-31 20:10:15 +0000 | [diff] [blame] | 183 | '6b894bae0411f6f21e76724047cc93e28a2b04176df31d0632b656e98ce9b6e8'); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 184 | |
| 185 | print("SUN True-Color Rasterfile ...\n"); |
| 186 | ++$test; |
| 187 | testReadWrite( 'SUN:input.im24', |
| 188 | 'SUN:output.im24', |
| 189 | q//, |
| cristy | 18139f0 | 2012-03-11 17:51:02 +0000 | [diff] [blame^] | 190 | '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33'); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 191 | |
| 192 | print("Truevision Targa image file ...\n"); |
| 193 | ++$test; |
| 194 | testReadWrite( 'TGA:input.tga', |
| 195 | 'TGA:output.tga', |
| 196 | q//, |
| cristy | 11165b7 | 2011-09-28 17:26:49 +0000 | [diff] [blame] | 197 | '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33'); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 198 | |
| 199 | print("Khoros Visualization image file ...\n"); |
| 200 | ++$test; |
| 201 | testReadWrite( 'VIFF:input.viff', |
| 202 | 'VIFF:output.viff', |
| 203 | q//, |
| cristy | 18139f0 | 2012-03-11 17:51:02 +0000 | [diff] [blame^] | 204 | 'c211b4dd4e0c3b1d42a96682b0d290ae6bed5652670abe3c7fcca54503611b3c', |
| 205 | 'bbeaa063bd13c74414a9962f21a795844661b596bd89f753f064ba1db2624d03'); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 206 | |
| 207 | print("WBMP (Wireless Bitmap (level 0) image) ...\n"); |
| 208 | ++$test; |
| 209 | testReadWrite( 'WBMP:input.wbmp', |
| 210 | 'WBMP:output.wbmp', |
| 211 | q//, |
| cristy | 18139f0 | 2012-03-11 17:51:02 +0000 | [diff] [blame^] | 212 | '6d1374fa22aa5cb8fa9e98b928b8dea6e5fc6606ed2dc07c5f27d1e03e494d0e'); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 213 | |
| 214 | print("X Windows system bitmap (black and white only) ...\n"); |
| 215 | ++$test; |
| 216 | testReadWrite( 'XBM:input.xbm', |
| 217 | 'XBM:output.xbm', |
| 218 | q//, |
| cristy | d2cb5a9 | 2011-12-31 20:10:15 +0000 | [diff] [blame] | 219 | 'cf6e645339d1bb82131ad658f2e7521f1e8aac69eb6e7add728f6157489972cd'); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 220 | |
| 221 | print("X Windows system pixmap file (color) ...\n"); |
| 222 | ++$test; |
| 223 | testReadWrite( 'XPM:input.xpm', |
| 224 | 'XPM:output.xpm', |
| 225 | q//, |
| cristy | 18139f0 | 2012-03-11 17:51:02 +0000 | [diff] [blame^] | 226 | 'a4c13fd97d6b9b32c016793d6ae2b01cee048b5f2790de8daaacccdf1c4b6956', |
| cristy | d2cb5a9 | 2011-12-31 20:10:15 +0000 | [diff] [blame] | 227 | '6b894bae0411f6f21e76724047cc93e28a2b04176df31d0632b656e98ce9b6e8'); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 228 | |
| 229 | print("CMYK format ...\n"); |
| 230 | ++$test; |
| 231 | testReadWriteSized( 'CMYK:input_70x46.cmyk', |
| 232 | 'CMYK:output_70x46.cmyk', |
| 233 | '70x46', |
| 234 | 8, |
| 235 | q//, |
| cristy | 11165b7 | 2011-09-28 17:26:49 +0000 | [diff] [blame] | 236 | '7e704fc1a99118630a92374ba27adf5baf69f30019016be2ed70eac79629e8b4'); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 237 | |
| 238 | print("GRAY format ...\n"); |
| 239 | ++$test; |
| 240 | testReadWriteSized( 'GRAY:input_70x46.gray', |
| 241 | 'GRAY:output_70x46.gray', |
| 242 | '70x46', |
| 243 | 8, |
| 244 | q//, |
| cristy | b241f38 | 2012-01-01 01:45:57 +0000 | [diff] [blame] | 245 | '04b3cafea6030665fbedcc3463711475bcda2ad35254e5a632d8772905f59ab9' ); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 246 | |
| 247 | print("RGB format ...\n"); |
| 248 | ++$test; |
| 249 | testReadWriteSized( 'RGB:input_70x46.rgb', |
| 250 | 'RGB:output_70x46.rgb', |
| 251 | '70x46', |
| 252 | 8, |
| 253 | q//, |
| cristy | 11165b7 | 2011-09-28 17:26:49 +0000 | [diff] [blame] | 254 | '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33' ); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 255 | |
| 256 | |
| 257 | print("RGBA format ...\n"); |
| 258 | ++$test; |
| 259 | testReadWriteSized( 'RGBA:input_70x46.rgba', |
| 260 | 'RGBA:output_70x46.rgba', |
| 261 | '70x46', |
| 262 | 8, |
| 263 | q//, |
| cristy | d2cb5a9 | 2011-12-31 20:10:15 +0000 | [diff] [blame] | 264 | 'e7d406ec41fe69ba2bd88dd59e5eb17a83f17c0a99519def02c020041144f5b3' ); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 265 | |
| 266 | 1; |