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