]> granicus.if.org Git - imagemagick/blob - PerlMagick/t/write.t
(no commit message)
[imagemagick] / PerlMagick / t / write.t
1 #!/usr/bin/perl
2 #  Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization
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//,
32   'a698f2fe0c6c31f83d19554a6ec02bac79c961dd9a87e7ed217752e75eb615d7');
33
34 print("Microsoft Windows bitmap image file ...\n");
35 ++$test;
36 testReadWrite( 'BMP:input.bmp',
37   'BMP:output.bmp',
38   q//,
39   '5a25065144213cd0230b7572bd9aef0e447c23a0622193a94ae62c9895c44bf7');
40
41 print("Microsoft Windows 24-bit bitmap image file ...\n");
42 ++$test;
43 testReadWrite( 'BMP:input.bmp24',
44   'BMP:output.bmp24',
45   q//,
46   'a698f2fe0c6c31f83d19554a6ec02bac79c961dd9a87e7ed217752e75eb615d7');
47
48
49 print("ZSoft IBM PC multi-page Paintbrush file ...\n");
50 ++$test;
51 testReadWrite( 'DCX:input.dcx',
52   'DCX:output.dcx',
53   q//,
54   'a698f2fe0c6c31f83d19554a6ec02bac79c961dd9a87e7ed217752e75eb615d7');
55
56 print("Microsoft Windows 3.X DIB file ...\n");
57 ++$test;
58 testReadWrite( 'DIB:input.dib',
59   'DIB:output.dib',
60   q//,
61   'a698f2fe0c6c31f83d19554a6ec02bac79c961dd9a87e7ed217752e75eb615d7');
62
63 print("Flexible Image Transport System ...\n");
64 ++$test;
65 testReadWrite( 'FITS:input.fits',
66   'FITS:output.fits',
67   q//,
68   '8365d1242126cb96856a9b4ade0bfad06900b4f42c3f05d589030c1240f37827' );
69
70 print("CompuServe graphics interchange format ...\n");
71 ++$test;
72 testReadWrite( 'GIF:input.gif',
73   'GIF:output.gif',
74   q//,
75   '5a25065144213cd0230b7572bd9aef0e447c23a0622193a94ae62c9895c44bf7');
76
77 print("CompuServe graphics interchange format (1987) ...\n");
78 ++$test;
79 testReadWrite( 'GIF87:input.gif87',
80   'GIF87:output.gif87',
81   q//,
82   '0138e1e5c9a7ed1604ec5bbe8c22378b84fcd9abb8c36e984b051f9efc14d54e');
83
84 print("Magick image file format ...\n");
85 ++$test;
86 testReadWrite( 'MIFF:input.miff',
87   'MIFF:output.miff',
88   q//,
89   'a698f2fe0c6c31f83d19554a6ec02bac79c961dd9a87e7ed217752e75eb615d7');
90
91 print("MTV Raytracing image format ...\n");
92 ++$test;
93 testReadWrite( 'MTV:input.mtv',
94   'MTV:output.mtv',
95   q//,
96   'a698f2fe0c6c31f83d19554a6ec02bac79c961dd9a87e7ed217752e75eb615d7');
97
98 print("Portable bitmap format (black and white), ASCII format ...\n");
99 ++$test;
100 testReadWrite( 'PBM:input_p1.pbm',
101   'PBM:output_p1.pbm',
102   q/compression=>'None'/,
103   '83175f7bcc43fb71212dee254c85e355c18bcd25f35d3b9caba66fff7341fa64');
104
105 print("Portable bitmap format (black and white), binary format ...\n");
106 ++$test;
107 testReadWrite( 'PBM:input_p4.pbm',
108   'PBM:output_p4.pbm',
109   q//,
110   '83175f7bcc43fb71212dee254c85e355c18bcd25f35d3b9caba66fff7341fa64');
111
112 print("ZSoft IBM PC Paintbrush file ...\n");
113 ++$test;
114 testReadWrite( 'PCX:input.pcx',
115   'PCX:output.pcx',
116   q//,
117   'a698f2fe0c6c31f83d19554a6ec02bac79c961dd9a87e7ed217752e75eb615d7');
118
119 print("Portable graymap format (gray scale), ASCII format ...\n");
120 ++$test;
121 testReadWrite( 'PGM:input_p2.pgm',
122   'PGM:output_p2.pgm',
123   q/compression=>'None'/,
124   '39bfd79b101f69842dfd0ee9dec46569147a22dc1557b84fadb60adb5b873f37');
125
126 print("Apple Macintosh QuickDraw/PICT file ...\n");
127 ++$test;
128 testReadWrite( 'PICT:input.pict',
129   'PICT:output.pict',
130   q//,
131   'a698f2fe0c6c31f83d19554a6ec02bac79c961dd9a87e7ed217752e75eb615d7');
132
133 print("Portable pixmap format (color), ASCII format ...\n");
134 ++$test;
135 testReadWrite( 'PPM:input_p3.ppm',
136   'PPM:output_p3.ppm',
137   q/compression=>'None'/,
138   'a698f2fe0c6c31f83d19554a6ec02bac79c961dd9a87e7ed217752e75eb615d7');
139
140 print("Portable graymap format (gray scale), binary format ...\n");
141 ++$test;
142 testReadWrite( 'PGM:input_p5.pgm',
143   'PGM:output_p5.pgm',
144   q//,
145   '39bfd79b101f69842dfd0ee9dec46569147a22dc1557b84fadb60adb5b873f37');
146
147 print("Portable pixmap format (color), binary format ...\n");
148 ++$test;
149 testReadWrite( 'PPM:input_p6.ppm',
150   'PPM:output_p6.ppm',
151   q//,
152   'a698f2fe0c6c31f83d19554a6ec02bac79c961dd9a87e7ed217752e75eb615d7');
153
154 print("Adobe Photoshop bitmap file ...\n");
155 ++$test;
156 testReadWrite( 'PSD:input.psd',
157   'PSD:output.psd',
158   q//,
159   'a698f2fe0c6c31f83d19554a6ec02bac79c961dd9a87e7ed217752e75eb615d7' );
160
161 print("Irix RGB image file ...\n");
162 ++$test;
163 testReadWrite( 'SGI:input.sgi',
164   'SGI:output.sgi',
165   q//,
166   'a698f2fe0c6c31f83d19554a6ec02bac79c961dd9a87e7ed217752e75eb615d7');
167
168 print("SUN 1-bit Rasterfile ...\n");
169 ++$test;
170 testReadWrite( 'SUN:input.im1',
171   'SUN:output.im1',
172   q//,
173   '8922c9505ece06295a015d23e28da3727c3bc7ab22593f98e0fc8784aa16d0c2');
174
175 print("SUN 8-bit Rasterfile ...\n");
176 ++$test;
177 testReadWrite( 'SUN:input.im8',
178   'SUN:output.im8',
179   q//,
180   'd28c7104a30c8986c34b98a4209de5d4b8a79911a9b5c46037e62c8a2063a09c');
181
182 print("SUN True-Color Rasterfile ...\n");
183 ++$test;
184 testReadWrite( 'SUN:input.im24',
185   'SUN:output.im24',
186   q//,
187   'a698f2fe0c6c31f83d19554a6ec02bac79c961dd9a87e7ed217752e75eb615d7',
188   'c44fd9695c066798a9dc010010cdff2921b95b67753164f3179352bafee98d10',
189   '5a5f94a626ee1945ab1d4d2a621aeec4982cccb94e4d68afe4c784abece91b3e');
190
191 print("Truevision Targa image file ...\n");
192 ++$test;
193 testReadWrite( 'TGA:input.tga',
194   'TGA:output.tga',
195   q//,
196   'a698f2fe0c6c31f83d19554a6ec02bac79c961dd9a87e7ed217752e75eb615d7');
197
198 print("Khoros Visualization image file ...\n");
199 ++$test;
200 testReadWrite( 'VIFF:input.viff',
201   'VIFF:output.viff',
202   q//,
203   '7f2c98e7ce98983509580eaeb3bb6a420e3f358b39fcec4cdd96982ae1e21882',
204   'ede99c6be1a9d82cd2f37b87dfd7cd5369391ff42b566ff1d5491f58e60637cb',
205   'aa4a6154f3c314d99c257280faf9097f3863a132ec8bddbc3b68209ce2c19487');
206
207 print("WBMP (Wireless Bitmap (level 0) image) ...\n");
208 ++$test;
209 testReadWrite( 'WBMP:input.wbmp',
210   'WBMP:output.wbmp',
211   q//,
212   'b7b682361e82d9d7cf2bed34f76af87576b97590b12d76b961104e53ee18ee74',
213   '1a3a1f20e9126794a0347d4920c497b5b203767d1a507db728901dc66874ea0d',
214   'd818195f73f8d5db624c8f87a706bbcb3179dbb7a7f08abbad5b12cd97de8fe6');
215
216 print("X Windows system bitmap (black and white only) ...\n");
217 ++$test;
218 testReadWrite( 'XBM:input.xbm',
219   'XBM:output.xbm',
220   q//,
221   '4cc91a24ddcbe4a9563b1ca063f765ec1ca4514cc3e3ba3e710f1226e49a8dd5');
222
223 print("X Windows system pixmap file (color) ...\n");
224 ++$test;
225 testReadWrite( 'XPM:input.xpm',
226   'XPM:output.xpm',
227   q//,
228   'fa51c37680393251b7011d1825df7a5ed4e0f78168afb4d6d5c59aa4d45ade12');
229
230 print("CMYK format ...\n");
231 ++$test;
232 testReadWriteSized( 'CMYK:input_70x46.cmyk',
233   'CMYK:output_70x46.cmyk',
234   '70x46',
235   8,
236   q//,
237   '1d9a2a8b39e8fc584ce24166e4e8a1544a5302b90fd84ff069d0d01c525f3462');
238
239 print("GRAY format ...\n");
240 ++$test;
241 testReadWriteSized( 'GRAY:input_70x46.gray',
242   'GRAY:output_70x46.gray',
243   '70x46',
244   8,
245   q//,
246   '8365d1242126cb96856a9b4ade0bfad06900b4f42c3f05d589030c1240f37827' );
247
248 print("RGB format ...\n");
249 ++$test;
250 testReadWriteSized( 'RGB:input_70x46.rgb',
251   'RGB:output_70x46.rgb',
252   '70x46',
253   8,
254   q//,
255   'a698f2fe0c6c31f83d19554a6ec02bac79c961dd9a87e7ed217752e75eb615d7' );
256
257
258 print("RGBA format ...\n");
259 ++$test;
260 testReadWriteSized( 'RGBA:input_70x46.rgba',
261   'RGBA:output_70x46.rgba',
262   '70x46',
263   8,
264   q//,
265   '1252b2f3facc0fb67fcfacfc01938843566acbb9480bbe077a4c6f6af528eb4e' );
266
267 1;