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