1 #!/usr/bin/perl 2 # 3 # Copyright 1999-2016 ImageMagick Studio LLC, a non-profit organization 4 # dedicated to making software imaging solutions freely available. 5 # 6 # You may not use this file except in compliance with the License. You may 7 # obtain a copy of the License at 8 # 9 # http://www.imagemagick.org/script/license.php 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 # 17 # Test image filters. 18 # 19 BEGIN { $| = 1; $test=1, print "1..58\n"; } 20 END {print "not ok 1\n" unless $loaded;} 21 use Image::Magick; 22 $loaded=1; 23 24 require 't/subroutines.pl'; 25 26 chdir 't' || die 'Cd failed'; 27 use FileHandle; 28 autoflush STDOUT 1; 29 autoflush STDERR 1; 30 31 $fuzz=int(0.05*(Image::Magick->new()->QuantumRange)); 32 33 testFilterCompare('input.miff', q//, 'reference/filter/AdaptiveThreshold.miff', 'AdaptiveThreshold', q/'5x5+5%'/, 0.0, 0.0); 34 ++$test; 35 36 testFilterCompare('input.miff', q//, 'reference/filter/Annotate.miff', 'Annotate', q/text=>'Magick',geometry=>'+0+20',font=>'Generic.ttf',fill=>'gold',gravity=>'North',pointsize=>14/, 0.05, 1.00); 37 ++$test; 38 39 testFilterCompare('input.miff', q//, 'reference/filter/Blur.miff', 'Blur', q/'5x2'/, 0.007, 0.7); 40 ++$test; 41 42 testFilterCompare('input.miff', q//, 'reference/filter/Border.miff', 'Border', q/geometry=>'6x6',color=>'gold'/, 0.0, 0.0); 43 ++$test; 44 45 testFilterCompare('input.miff', q//, 'reference/filter/Channel.miff', 'Channel', q/channel=>'red'/, 0.2, 0.8); 46 ++$test; 47 48 testFilterCompare('input.miff', q//, 'reference/filter/Chop.miff', 'Chop', q/geometry=>'80x80+5+10'/, 0.0, 0.0); 49 ++$test; 50 51 testFilterCompare('input.miff', q//, 'reference/filter/Charcoal.miff', 'Charcoal', q/'0x1'/, 0.3, 1.01); 52 ++$test; 53 54 testFilterCompare('input.miff', "fuzz=>$fuzz", 'reference/filter/ColorFloodfill.miff', 'ColorFloodfill', q/geometry=>"+25+45"/, 0.15, 1.0); 55 ++$test; 56 57 testFilterCompare('input.miff', "fuzz=>$fuzz", 'reference/filter/Colorize.miff', 'Colorize', q/fill=>"red", blend=>"50%"/, 0.0, 0.0 ); 58 ++$test; 59 60 testFilterCompare('input.miff', q//, 'reference/filter/Contrast.miff', 'Contrast', q//, 0.0, 0.0); 61 ++$test; 62 63 testFilterCompare('input.miff', q//, 'reference/filter/Convolve.miff', 'Convolve', q/[0.0625, 0.0625, 0.0625, 0.0625, 0.5, 0.0625, 0.0625, 0.0625, 0.0625]/, 0.1, 0.7); 64 ++$test; 65 66 testFilterCompare('input.miff', q//, 'reference/filter/Crop.miff', 'Crop', q/geometry=>'80x80+5+10'/, 0.0, 0.0); 67 ++$test; 68 69 testFilterCompare('input.miff', q//, 'reference/filter/Set.miff', 'Set', q/page=>'0x0+0+0'/, 0.0, 0.0); 70 ++$test; 71 72 testFilterCompare('input.miff', q//, 'reference/filter/Despeckle.miff', 'Despeckle', q//, 0.0, 0.0); 73 ++$test; 74 75 testFilterCompare('input.miff', q//, 'reference/filter/Draw.miff', 'Draw', q/fill=>'none',stroke=>'gold',primitive=>'circle',points=>'60,90 60,120',strokewidth=>2/, 0.0, 0.0); 76 ++$test; 77 78 testFilterCompare('input.miff', q//, 'reference/filter/Edge.miff', 'Edge', q//, 0.31, 1.01); 79 ++$test; 80 81 testFilterCompare('input.miff', q//, 'reference/filter/Emboss.miff', 'Emboss', q/'0x1'/, 0.2, 1.0); 82 ++$test; 83 84 testFilterCompare('input.miff', q//, 'reference/filter/Equalize.miff', 'Equalize', q//, 0.06, 0.5); 85 ++$test; 86 87 testFilterCompare('input.miff', q//, 'reference/filter/Implode.miff', 'Implode', q/0.0/, 0.0, 0.0); 88 ++$test; 89 90 testFilterCompare('input.miff', q//, 'reference/filter/Flip.miff', 'Flip', q//, 0.0, 0.0); 91 ++$test; 92 93 testFilterCompare('input.miff', q//, 'reference/filter/Flop.miff', 'Flop', q//, 0.0, 0.0); 94 ++$test; 95 96 testFilterCompare('input.miff', q//, 'reference/filter/Frame.miff', 'Frame', q/'15x15+3+3'/, 0.02, 0.5); 97 ++$test; 98 99 testFilterCompare('input.miff', q//, 'reference/filter/Gamma.miff', 'Gamma', q/1.6/, 0.0, 0.0); 100 ++$test; 101 102 testFilterCompare('input.miff', q//, 'reference/filter/GaussianBlur.miff', 'GaussianBlur', q/'0.0x1.5'/, 0.07, 0.9); 103 ++$test; 104 105 testFilterCompare('input.miff', q//, 'reference/filter/Implode.miff', 'Implode', q/0.0/, 0.0, 0.0); 106 ++$test; 107 108 testFilterCompare('input.miff', q//, 'reference/filter/Level.miff', 'Level', q/'20%x'/, 0.0, 0.0); 109 ++$test; 110 111 testFilterCompare('input.miff', q//, 'reference/filter/Magnify.miff', 'Magnify', q//, 0.003, 0.3); 112 ++$test; 113 114 testFilterCompare('input.miff', "fuzz=>$fuzz", 'reference/filter/MatteFloodfill.miff', 'MatteFloodfill', q/geometry=>"+25+45"/, 0.25, 1.0); 115 ++$test; 116 117 testFilterCompare('input.miff', q//, 'reference/filter/MedianFilter.miff', 'MedianFilter', q//, 0.0, 0.0); 118 ++$test; 119 120 testFilterCompare('input.miff', q//, 'reference/filter/Minify.miff', 'Minify', q//, 0.00001, 0.004); 121 ++$test; 122 123 testFilterCompare('input.miff', q//, 'reference/filter/Modulate.miff', 'Modulate', q/brightness=>110,saturation=>110,hue=>110/, 0.05, 0.5); 124 ++$test; 125 126 testFilterCompare('input.miff', q//, 'reference/filter/QuantizeMono.miff', 'Quantize', q/colors=>256/, 0.2, 0.7); 127 ++$test; 128 129 testFilterCompare('input.miff', q//, 'reference/filter/MotionBlur.miff', 'MotionBlur', q/'0x13+10-10'/, 0.002, 0.04); 130 ++$test; 131 132 testFilterCompare('input.miff', q//, 'reference/filter/Negate.miff', 'Negate', q//, 0.0, 0.0); 133 ++$test; 134 135 testFilterCompare('input.miff', q//, 'reference/filter/Normalize.miff', 'Normalize', q//, 0.02, 0.2); 136 ++$test; 137 138 testFilterCompare('input.miff', q//, 'reference/filter/OilPaint.miff', 'OilPaint', q//, 0.03, 1.0); 139 ++$test; 140 141 testFilterCompare('input.miff', "fuzz=>$fuzz", 'reference/filter/Opaque.miff', 'Opaque', q/color=>"#e23834", fill=>"green"/, 0.0, 0.0); 142 ++$test; 143 144 testFilterCompare('input.miff', q//, 'reference/filter/Quantize.miff', 'Quantize', q//, 0.2, 0.7); 145 ++$test; 146 147 testFilterCompare('input.miff', q//, 'reference/filter/RadialBlur.miff', 'RadialBlur', q/10/, 0.004, 0.4); 148 ++$test; 149 150 testFilterCompare('input.miff', q//, 'reference/filter/Raise.miff', 'Raise', q/'10x10'/, 0.0, 0.0); 151 ++$test; 152 153 testFilterCompare('input.miff', q//, 'reference/filter/ReduceNoise.miff', 'ReduceNoise', q//, 0.0, 0.0); 154 ++$test; 155 156 testFilterCompare('input.miff', q//, 'reference/filter/Resize.miff', 'Resize', q/'60%'/, 0.00007, 0.07); 157 ++$test; 158 159 testFilterCompare('input.miff', q//, 'reference/filter/Roll.miff', 'Roll', q/geometry=>'+20+10'/, 0.0, 0.0); 160 ++$test; 161 162 testFilterCompare('input.miff', q//, 'reference/filter/Rotate.miff', 'Rotate', q/45/, 0.00004, 0.04); 163 ++$test; 164 165 testFilterCompare('input.miff', q//, 'reference/filter/Sample.miff', 'Sample', q/'60%'/, 0.006, 0.6); 166 ++$test; 167 168 testFilterCompare('input.miff', q//, 'reference/filter/Scale.miff', 'Scale', q/'60%'/, 0.0, 0.0); 169 ++$test; 170 171 testFilterCompare('input.miff', q//, 'reference/filter/Segment.miff', 'Segment', q//, 0.09, 0.9); 172 ++$test; 173 174 testFilterCompare('input.miff', q//, 'reference/filter/Shade.miff', 'Shade', q/geometry=>'30x30',gray=>'true'/, 0.09, 0.9); 175 ++$test; 176 177 testFilterCompare('input.miff', q//, 'reference/filter/Sharpen.miff', 'Sharpen', q/'5x2'/, 0.1, 1.001); 178 ++$test; 179 180 testFilterCompare('input.miff', q//, 'reference/filter/Shave.miff', 'Shave', q/'10x10'/, 0.0, 0.0); 181 ++$test; 182 183 testFilterCompare('input.miff', q//, 'reference/filter/Shear.miff', 'Shear', q/'-20x20'/, 0.00001, 0.004); 184 ++$test; 185 186 testFilterCompare('input.miff', q//, 'reference/filter/SigmoidalContrast.miff', 'SigmoidalContrast', q/"3x50%"/, 0.00001, 0.004); 187 ++$test; 188 189 testFilterCompare('input.miff', q//, 'reference/filter/Solarize.miff', 'Solarize', q//, 0.0, 0.0); 190 ++$test; 191 192 testFilterCompare('input.miff', q//, 'reference/filter/Swirl.miff', 'Swirl', q/90/, 0.0, 0.0); 193 ++$test; 194 195 testFilterCompare('input.miff', q//, 'reference/filter/Threshold.miff', 'Threshold', q/90%/, 0.0, 0.0); 196 ++$test; 197 198 testFilterCompare('input.miff', q//, 'reference/filter/Trim.miff', 'Trim', q//, 0.0, 0.0); 199 ++$test; 200 201 testFilterCompare('input.miff', q//, 'reference/filter/UnsharpMask.miff', 'UnsharpMask', q/'5x2+1'/, 0.004, 0.4); 202 ++$test; 203 204 testFilterCompare('input.miff', q//, 'reference/filter/Wave.miff', 'Wave', q/'25x150'/, 0.0, 0.0); 205 ++$test; 206 207 1; 208