blob: a32432d252bab8ce580f2f94a16441365247b0f8 [file] [log] [blame]
cristy3ed852e2009-09-05 21:47:34 +00001#!/usr/bin/perl
cristy1454be72011-12-19 01:52:48 +00002# Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization
cristy3ed852e2009-09-05 21:47:34 +00003# 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
19BEGIN { $| = 1; $test=1; print "1..32\n"; }
20END {print "not ok $test\n" unless $loaded;}
21use Image::Magick;
22$loaded=1;
23
24require 't/subroutines.pl';
25
26chdir 't' || die 'Cd failed';
27
28print("AVS X image file ...\n");
29testReadWrite( 'AVS:input.avs',
30 'AVS:output.avs',
31 q//,
cristy11165b72011-09-28 17:26:49 +000032 '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33');
cristy3ed852e2009-09-05 21:47:34 +000033
34print("Microsoft Windows bitmap image file ...\n");
35++$test;
36testReadWrite( 'BMP:input.bmp',
37 'BMP:output.bmp',
38 q//,
cristy11165b72011-09-28 17:26:49 +000039 '32d82b4ab7a2527d0b886ccdd60990f6f7e4a411181337bd033760256c0d596c');
cristy3ed852e2009-09-05 21:47:34 +000040
41print("Microsoft Windows 24-bit bitmap image file ...\n");
42++$test;
43testReadWrite( 'BMP:input.bmp24',
44 'BMP:output.bmp24',
45 q//,
cristy11165b72011-09-28 17:26:49 +000046 '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33');
cristy3ed852e2009-09-05 21:47:34 +000047
48
49print("ZSoft IBM PC multi-page Paintbrush file ...\n");
50++$test;
51testReadWrite( 'DCX:input.dcx',
52 'DCX:output.dcx',
53 q//,
cristy11165b72011-09-28 17:26:49 +000054 '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33');
cristy3ed852e2009-09-05 21:47:34 +000055
56print("Microsoft Windows 3.X DIB file ...\n");
57++$test;
58testReadWrite( 'DIB:input.dib',
59 'DIB:output.dib',
60 q//,
cristy11165b72011-09-28 17:26:49 +000061 '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33');
cristy3ed852e2009-09-05 21:47:34 +000062
63print("Flexible Image Transport System ...\n");
64++$test;
65testReadWrite( 'FITS:input.fits',
66 'FITS:output.fits',
67 q//,
cristy11165b72011-09-28 17:26:49 +000068 'f28470f09857477a372a743665071cdc325613b963481d94b6dceabe292dd469' );
cristy3ed852e2009-09-05 21:47:34 +000069
70print("CompuServe graphics interchange format ...\n");
71++$test;
72testReadWrite( 'GIF:input.gif',
73 'GIF:output.gif',
74 q//,
cristy11165b72011-09-28 17:26:49 +000075 '32d82b4ab7a2527d0b886ccdd60990f6f7e4a411181337bd033760256c0d596c');
cristy3ed852e2009-09-05 21:47:34 +000076
77print("CompuServe graphics interchange format (1987) ...\n");
78++$test;
79testReadWrite( 'GIF87:input.gif87',
80 'GIF87:output.gif87',
81 q//,
cristy11165b72011-09-28 17:26:49 +000082 'd8938f29cbd56aa164bf8265f385d9ec872be75fe08401601b68eee159df8cd9');
cristy3ed852e2009-09-05 21:47:34 +000083
84print("Magick image file format ...\n");
85++$test;
86testReadWrite( 'MIFF:input.miff',
87 'MIFF:output.miff',
88 q//,
cristy11165b72011-09-28 17:26:49 +000089 '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33');
cristy3ed852e2009-09-05 21:47:34 +000090
91print("MTV Raytracing image format ...\n");
92++$test;
93testReadWrite( 'MTV:input.mtv',
94 'MTV:output.mtv',
95 q//,
cristy11165b72011-09-28 17:26:49 +000096 '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33');
cristy3ed852e2009-09-05 21:47:34 +000097
98print("Portable bitmap format (black and white), ASCII format ...\n");
99++$test;
100testReadWrite( 'PBM:input_p1.pbm',
101 'PBM:output_p1.pbm',
102 q/compression=>'None'/,
cristy11165b72011-09-28 17:26:49 +0000103 '57fc672e7e231d3f92793d9b2073132def273f4be3115bcbed1c49a1c3131222');
cristy3ed852e2009-09-05 21:47:34 +0000104
105print("Portable bitmap format (black and white), binary format ...\n");
106++$test;
107testReadWrite( 'PBM:input_p4.pbm',
108 'PBM:output_p4.pbm',
109 q//,
cristy11165b72011-09-28 17:26:49 +0000110 '57fc672e7e231d3f92793d9b2073132def273f4be3115bcbed1c49a1c3131222');
cristy3ed852e2009-09-05 21:47:34 +0000111
112print("ZSoft IBM PC Paintbrush file ...\n");
113++$test;
114testReadWrite( 'PCX:input.pcx',
115 'PCX:output.pcx',
116 q//,
cristy11165b72011-09-28 17:26:49 +0000117 '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33');
cristy3ed852e2009-09-05 21:47:34 +0000118
119print("Portable graymap format (gray scale), ASCII format ...\n");
120++$test;
121testReadWrite( 'PGM:input_p2.pgm',
122 'PGM:output_p2.pgm',
123 q/compression=>'None'/,
cristy11165b72011-09-28 17:26:49 +0000124 'e2e1b058a09c2b9c0c696996163911dcce325def773cb2a1554c6f21a0391ff7');
cristy3ed852e2009-09-05 21:47:34 +0000125
126print("Apple Macintosh QuickDraw/PICT file ...\n");
127++$test;
128testReadWrite( 'PICT:input.pict',
129 'PICT:output.pict',
130 q//,
cristy11165b72011-09-28 17:26:49 +0000131 '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33');
cristy3ed852e2009-09-05 21:47:34 +0000132
133print("Portable pixmap format (color), ASCII format ...\n");
134++$test;
135testReadWrite( 'PPM:input_p3.ppm',
136 'PPM:output_p3.ppm',
137 q/compression=>'None'/,
cristy11165b72011-09-28 17:26:49 +0000138 '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33');
cristy3ed852e2009-09-05 21:47:34 +0000139
140print("Portable graymap format (gray scale), binary format ...\n");
141++$test;
142testReadWrite( 'PGM:input_p5.pgm',
143 'PGM:output_p5.pgm',
144 q//,
cristy11165b72011-09-28 17:26:49 +0000145 'e2e1b058a09c2b9c0c696996163911dcce325def773cb2a1554c6f21a0391ff7');
cristy3ed852e2009-09-05 21:47:34 +0000146
147print("Portable pixmap format (color), binary format ...\n");
148++$test;
149testReadWrite( 'PPM:input_p6.ppm',
150 'PPM:output_p6.ppm',
151 q//,
cristy11165b72011-09-28 17:26:49 +0000152 '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33');
cristy3ed852e2009-09-05 21:47:34 +0000153
154print("Adobe Photoshop bitmap file ...\n");
155++$test;
156testReadWrite( 'PSD:input.psd',
157 'PSD:output.psd',
158 q//,
cristy11165b72011-09-28 17:26:49 +0000159 '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33' );
cristy3ed852e2009-09-05 21:47:34 +0000160
161print("Irix RGB image file ...\n");
162++$test;
163testReadWrite( 'SGI:input.sgi',
164 'SGI:output.sgi',
165 q//,
cristy11165b72011-09-28 17:26:49 +0000166 '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33');
cristy3ed852e2009-09-05 21:47:34 +0000167
168print("SUN 1-bit Rasterfile ...\n");
169++$test;
170testReadWrite( 'SUN:input.im1',
171 'SUN:output.im1',
172 q//,
cristy11165b72011-09-28 17:26:49 +0000173 '31d166e543d44963cc8a500212ae60c1c6f040fac3117748bcd54174727b45e1');
cristy3ed852e2009-09-05 21:47:34 +0000174
175print("SUN 8-bit Rasterfile ...\n");
176++$test;
177testReadWrite( 'SUN:input.im8',
178 'SUN:output.im8',
179 q//,
cristy11165b72011-09-28 17:26:49 +0000180 '88528b9fde504a6388f0db5a351e3373ea15607e18a0c2d0e7e0fe4c851cce10');
cristy3ed852e2009-09-05 21:47:34 +0000181
182print("SUN True-Color Rasterfile ...\n");
183++$test;
184testReadWrite( 'SUN:input.im24',
185 'SUN:output.im24',
186 q//,
cristy11165b72011-09-28 17:26:49 +0000187 '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33',
188 '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33',
cristy3ed852e2009-09-05 21:47:34 +0000189 '5a5f94a626ee1945ab1d4d2a621aeec4982cccb94e4d68afe4c784abece91b3e');
190
191print("Truevision Targa image file ...\n");
192++$test;
193testReadWrite( 'TGA:input.tga',
194 'TGA:output.tga',
195 q//,
cristy11165b72011-09-28 17:26:49 +0000196 '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33');
cristy3ed852e2009-09-05 21:47:34 +0000197
198print("Khoros Visualization image file ...\n");
199++$test;
200testReadWrite( 'VIFF:input.viff',
201 'VIFF:output.viff',
202 q//,
203 '7f2c98e7ce98983509580eaeb3bb6a420e3f358b39fcec4cdd96982ae1e21882',
cristy11165b72011-09-28 17:26:49 +0000204 '409e646b6ba024c597a6b2c34754bf23713857e367047e7ea15615d8bd0fd028',
cristy3ed852e2009-09-05 21:47:34 +0000205 'aa4a6154f3c314d99c257280faf9097f3863a132ec8bddbc3b68209ce2c19487');
206
207print("WBMP (Wireless Bitmap (level 0) image) ...\n");
208++$test;
209testReadWrite( 'WBMP:input.wbmp',
210 'WBMP:output.wbmp',
211 q//,
212 'b7b682361e82d9d7cf2bed34f76af87576b97590b12d76b961104e53ee18ee74',
cristy11165b72011-09-28 17:26:49 +0000213 'd386466607cfcec0625943f277454d66cce1d17696d482f50103a25a04bd1070',
cristy3ed852e2009-09-05 21:47:34 +0000214 'd818195f73f8d5db624c8f87a706bbcb3179dbb7a7f08abbad5b12cd97de8fe6');
215
216print("X Windows system bitmap (black and white only) ...\n");
217++$test;
218testReadWrite( 'XBM:input.xbm',
219 'XBM:output.xbm',
220 q//,
cristy11165b72011-09-28 17:26:49 +0000221 '31d166e543d44963cc8a500212ae60c1c6f040fac3117748bcd54174727b45e1');
cristy3ed852e2009-09-05 21:47:34 +0000222
223print("X Windows system pixmap file (color) ...\n");
224++$test;
225testReadWrite( 'XPM:input.xpm',
226 'XPM:output.xpm',
227 q//,
cristy11165b72011-09-28 17:26:49 +0000228 '88528b9fde504a6388f0db5a351e3373ea15607e18a0c2d0e7e0fe4c851cce10');
cristy3ed852e2009-09-05 21:47:34 +0000229
230print("CMYK format ...\n");
231++$test;
232testReadWriteSized( 'CMYK:input_70x46.cmyk',
233 'CMYK:output_70x46.cmyk',
234 '70x46',
235 8,
236 q//,
cristy11165b72011-09-28 17:26:49 +0000237 '7e704fc1a99118630a92374ba27adf5baf69f30019016be2ed70eac79629e8b4');
cristy3ed852e2009-09-05 21:47:34 +0000238
239print("GRAY format ...\n");
240++$test;
241testReadWriteSized( 'GRAY:input_70x46.gray',
242 'GRAY:output_70x46.gray',
243 '70x46',
244 8,
245 q//,
cristy11165b72011-09-28 17:26:49 +0000246 'f28470f09857477a372a743665071cdc325613b963481d94b6dceabe292dd469' );
cristy3ed852e2009-09-05 21:47:34 +0000247
248print("RGB format ...\n");
249++$test;
250testReadWriteSized( 'RGB:input_70x46.rgb',
251 'RGB:output_70x46.rgb',
252 '70x46',
253 8,
254 q//,
cristy11165b72011-09-28 17:26:49 +0000255 '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33' );
cristy3ed852e2009-09-05 21:47:34 +0000256
257
258print("RGBA format ...\n");
259++$test;
260testReadWriteSized( 'RGBA:input_70x46.rgba',
261 'RGBA:output_70x46.rgba',
262 '70x46',
263 8,
264 q//,
cristy11165b72011-09-28 17:26:49 +0000265 '6a4a257921582768b774aeeac549b7c0c0b51f665395eddf921cce53a0ad2a33' );
cristy3ed852e2009-09-05 21:47:34 +0000266
2671;