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 reading formats supported directly by ImageMagick. 17 # 18 BEGIN { $| = 1; $test=1; print "1..47\n"; } 19 END {print "not ok $test\n" unless $loaded;} 20 use Image::Magick; 21 $loaded=1; 22 23 require 't/subroutines.pl'; 24 25 chdir 't' || die 'Cd failed'; 26 27 print("AVS X image file ...\n"); 28 testReadCompare('input.avs', 'reference/read/input_avs.miff', q//, 0.0, 0.0); 29 30 print("Microsoft Windows bitmap image file ...\n"); 31 ++$test; 32 testReadCompare('input.bmp', 'reference/read/input_bmp.miff', q//, 0.0, 0.0); 33 34 print("Microsoft Windows 24-bit bitmap image file ...\n"); 35 ++$test; 36 testReadCompare('input.bmp24', 'reference/read/input_bmp24.miff', q//, 0.0, 0.0); 37 38 print("ZSoft IBM PC multi-page Paintbrush file ...\n"); 39 ++$test; 40 testReadCompare('input.dcx', 'reference/read/input_dcx.miff', q//, 0.0, 0.0); 41 42 print("Microsoft Windows bitmap image file ...\n"); 43 ++$test; 44 testReadCompare('input.dib', 'reference/read/input_dib.miff', q//, 0.0, 0.0); 45 46 print("Flexible Image Transport System ...\n"); 47 ++$test; 48 testReadCompare('input.fits', 'reference/read/input_fits.miff', q//, 0.06, 0.6); 49 50 print("CompuServe graphics interchange format ...\n"); 51 ++$test; 52 testReadCompare('input.gif', 'reference/read/input_gif.miff', q//, 0.0, 0.0); 53 54 print("CompuServe graphics interchange format (1987) ...\n"); 55 ++$test; 56 testReadCompare('input.gif87', 'reference/read/input_gif87.miff', q//, 0.0, 0.0); 57 58 print("Gradient (gradual passing from one shade to another) ...\n"); 59 ++$test; 60 testReadCompare('gradient:red-blue', 'reference/read/gradient.miff', 61 q/size=>"70x46"/, 0.03, 0.3); 62 63 print("GRANITE (granite texture) ...\n"); 64 ++$test; 65 testReadCompare('granite:', 'reference/read/granite.miff', q/size=>"70x46"/, 0.0, 0.0); 66 67 print("MAT (MatLab gray 8-bit LSB integer) ...\n"); 68 ++$test; 69 testReadCompare('input_gray_lsb_08bit.mat', 'reference/read/input_gray_lsb_08bit_mat.miff', q//, 0.3, 1.03); 70 71 print("MAT (MatLab gray 8-bit MSB integer) ...\n"); 72 ++$test; 73 testReadCompare('input_gray_msb_08bit.mat', 'reference/read/input_gray_msb_08bit_mat.miff', q//, 0.22, 1.022); 74 75 print("MAT (MatLab gray 64-bit LSB double) ...\n"); 76 ++$test; 77 testReadCompare('input_gray_lsb_double.mat', 'reference/read/input_gray_lsb_double_mat.miff', q//, 0.22, 1.022); 78 79 print("MAT (MatLab RGB 8-bit LSB integer) ...\n"); 80 ++$test; 81 testReadCompare('input_rgb_lsb_08bit.mat', 'reference/read/input_rgb_lsb_08bit_mat.miff', q//, 0.0, 0.0); 82 83 print("Microsoft icon ...\n"); 84 ++$test; 85 testReadCompare('input.ico', 'reference/read/input_ico.miff', q//, 0.0, 0.0); 86 87 print("Magick image file format ...\n"); 88 ++$test; 89 testReadCompare('input.miff', 'reference/read/input_miff.miff', q//, 0.0, 0.0); 90 91 print("MTV Raytracing image format ...\n"); 92 ++$test; 93 testReadCompare('input.mtv', 'reference/read/input_mtv.miff', q//, 0.0, 0.0); 94 95 print("NULL (white image) ...\n"); 96 ++$test; 97 testReadCompare('NULL:white', 'reference/read/input_null_white.miff', q/size=>"70x46"/, 0.0, 0.0); 98 99 print("NULL (black image) ...\n"); 100 ++$test; 101 testReadCompare('NULL:black', 'reference/read/input_null_black.miff', q/size=>"70x46"/, 0.0, 0.0); 102 103 print("NULL (DarkOrange image) ...\n"); 104 ++$test; 105 testReadCompare('NULL:DarkOrange', 'reference/read/input_null_DarkOrange.miff', q/size=>"70x46"/, 0.0, 0.0); 106 107 print("Portable bitmap format (black and white), ASCII format ...\n"); 108 ++$test; 109 testReadCompare('input_p1.pbm', 'reference/read/input_pbm_p1.miff', q//, 0.0, 0.0); 110 111 print("Portable bitmap format (black and white), binary format ...\n"); 112 ++$test; 113 testReadCompare('input_p4.pbm', 'reference/read/input_pbm_p4.miff', q//, 0.0, 0.0); 114 115 print("ZSoft IBM PC Paintbrush file ...\n"); 116 ++$test; 117 testReadCompare('input.pcx', 'reference/read/input_pcx.miff', q//, 0.0, 0.0); 118 119 print("Portable graymap format (gray scale), ASCII format ...\n"); 120 ++$test; 121 testReadCompare('input_p2.pgm', 'reference/read/input_pgm_p2.miff', q//, 0.06, 0.6); 122 123 print("Portable graymap format (gray scale), binary format ...\n"); 124 ++$test; 125 testReadCompare('input_p5.pgm', 'reference/read/input_pgm_p5.miff', q//, 0.06, 0.6); 126 127 print("Apple Macintosh QuickDraw/PICT file ...\n"); 128 ++$test; 129 testReadCompare('input.pict', 'reference/read/input_pict.miff', q//, 0.0, 0.0); 130 131 print("Alias/Wavefront RLE image format ...\n"); 132 ++$test; 133 testReadCompare('input.rle', 'reference/read/input_rle.miff', q//, 0.0, 0.0); 134 135 print("Portable pixmap format (color), ASCII format ...\n"); 136 ++$test; 137 testReadCompare('input_p3.ppm', 'reference/read/input_ppm_p3.miff', q//, 0.0, 0.0); 138 139 print("Portable pixmap format (color), binary format ...\n"); 140 ++$test; 141 testReadCompare('input_p6.ppm', 'reference/read/input_ppm_p6.miff', q//, 0.0, 0.0); 142 143 print("Adobe Photoshop bitmap file ...\n"); 144 ++$test; 145 testReadCompare('input.psd', 'reference/read/input_psd.miff', q//, 0.0, 0.0); 146 147 print("Irix RGB image file ...\n"); 148 ++$test; 149 testReadCompare('input.sgi', 'reference/read/input_sgi.miff', q//, 0.0, 0.0); 150 151 print("SUN 1-bit Rasterfile ...\n"); 152 ++$test; 153 testReadCompare('input.im1', 'reference/read/input_im1.miff', q//, 0.0, 0.0); 154 155 print("SUN 8-bit Rasterfile ...\n"); 156 ++$test; 157 testReadCompare('input.im8', 'reference/read/input_im8.miff', q//, 0.0, 0.0); 158 159 print("SUN TrueColor Rasterfile ...\n"); 160 ++$test; 161 testReadCompare('sun:input.im24', 'reference/read/input_im24.miff', q//, 0.0, 0.0); 162 163 print("Truevision Targa image file ...\n"); 164 ++$test; 165 testReadCompare('input.tga', 'reference/read/input_tga.miff', q//, 0.0, 0.0); 166 167 print("PSX TIM file ...\n"); 168 ++$test; 169 testReadCompare('input.tim', 'reference/read/input_tim.miff', q//, 0.0, 0.0); 170 171 print("Khoros Visualization image file ...\n"); 172 ++$test; 173 testReadCompare('input.viff', 'reference/read/input_viff.miff', q//, 0.0, 0.0); 174 175 print("WBMP (Wireless Bitmap (level 0) image) ...\n"); 176 ++$test; 177 testReadCompare('input.wbmp', 'reference/read/input_wbmp.miff', q//, 0.0, 0.0); 178 179 print("X Windows system bitmap (black and white only) ...\n"); 180 ++$test; 181 testReadCompare('input.xbm', 'reference/read/input_xbm.miff', q//, 0.0, 0.0); 182 183 print("XC: Constant image of X server color ...\n"); 184 ++$test; 185 testReadCompare('xc:black', 'reference/read/input_xc_black.miff', q/size=>"70x46",, depth=>8/, 0.0, 0.0); 186 187 print("X Windows system pixmap file (color) ...\n"); 188 ++$test; 189 testReadCompare('input.xpm', 'reference/read/input_xpm.miff', q//, 0.0, 0.0); 190 191 print("TILE (Tile image with a texture) ...\n"); 192 # This is an internal generated format 193 # We will tile using the default image and a MIFF file 194 # 195 ++$test; 196 testReadCompare('TILE:input.miff', 'reference/read/input_tile.miff', 197 q/size=>"140x92", depth=>8/, 0.0, 0.0); 198 199 print("CMYK format ...\n"); 200 ++$test; 201 testReadCompare('cmyk:input_70x46.cmyk', 'reference/read/input_cmyk.miff', 202 q/size=>"70x46", depth=>8/, 0.0, 0.0); 203 204 print("GRAY format ...\n"); 205 ++$test; 206 testReadCompare('gray:input_70x46.gray', 'reference/read/input_gray.miff', 207 q/size=>"70x46", depth=>8/, 0.0, 0.0); 208 209 print("RGB format ...\n"); 210 ++$test; 211 testReadCompare('rgb:input_70x46.rgb', 'reference/read/input_rgb.miff', 212 q/size=>"70x46", depth=>8/, 0.0, 0.0); 213 214 print("RGBA format ...\n"); 215 ++$test; 216 testReadCompare('rgba:input_70x46.rgba', 'reference/read/input_rgba.miff', 217 q/size=>"70x46", depth=>8/, 0.0, 0.0); 218 219 print("UYVY format ...\n"); 220 ++$test; 221 testReadCompare('uyvy:input_70x46.uyvy', 'reference/read/input_uyvy.miff', 222 q/size=>"70x46", depth=>8/, 0.0, 0.0); 223