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