| 1 | #!/usr/bin/perl |
|---|
| 2 | # |
|---|
| 3 | # Copyright 1999-2010 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*QuantumRange); |
|---|
| 32 | |
|---|
| 33 | testFilterCompare('input.miff', q//, 'reference/filter/AdaptiveThreshold.miff', 'AdaptiveThreshold', q/'5x5+5%'/, 0.30, 1.02); |
|---|
| 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.02, 1.02); |
|---|
| 37 | ++$test; |
|---|
| 38 | |
|---|
| 39 | testFilterCompare('input.miff', q//, 'reference/filter/Blur.miff', 'Blur', q/'0.0x1.0'/, 0.002, 0.02); |
|---|
| 40 | ++$test; |
|---|
| 41 | |
|---|
| 42 | testFilterCompare('input.miff', q//, 'reference/filter/Border.miff', 'Border', q/geometry=>'6x6',color=>'gold'/, 0.002, 0.02); |
|---|
| 43 | ++$test; |
|---|
| 44 | |
|---|
| 45 | testFilterCompare('input.miff', q//, 'reference/filter/Channel.miff', 'Channel', q/channel=>'red'/, 0.002, 0.02); |
|---|
| 46 | ++$test; |
|---|
| 47 | |
|---|
| 48 | testFilterCompare('input.miff', q//, 'reference/filter/Chop.miff', 'Chop', q/geometry=>'80x80+5+10'/, 0.002, 0.02); |
|---|
| 49 | ++$test; |
|---|
| 50 | |
|---|
| 51 | testFilterCompare('input.miff', q//, 'reference/filter/Charcoal.miff', 'Charcoal', q/'0x1'/, 0.2, 1.02); |
|---|
| 52 | ++$test; |
|---|
| 53 | |
|---|
| 54 | testFilterCompare('input.miff', "fuzz=>$fuzz", 'reference/filter/ColorFloodfill.miff', 'ColorFloodfill', q/geometry=>"+25+45"/, 0.03, 1.02); |
|---|
| 55 | ++$test; |
|---|
| 56 | |
|---|
| 57 | testFilterCompare('input.miff', "fuzz=>$fuzz", 'reference/filter/Colorize.miff', 'Colorize', q/fill=>"red", opacity=>"50%"/, 0.02, 0.5 ); |
|---|
| 58 | ++$test; |
|---|
| 59 | |
|---|
| 60 | testFilterCompare('input.miff', q//, 'reference/filter/Contrast.miff', 'Contrast', q//, 0.06, 0.6); |
|---|
| 61 | ++$test; |
|---|
| 62 | |
|---|
| 63 | testFilterCompare('input.miff', q//, 'reference/filter/Convolve.miff', 'Convolve', q/[1, 1, 1, 1, 4, 1, 1, 1, 1]/, 0.002, 0.02); |
|---|
| 64 | ++$test; |
|---|
| 65 | |
|---|
| 66 | testFilterCompare('input.miff', q//, 'reference/filter/Crop.miff', 'Crop', q/geometry=>'80x80+5+10'/, 0.002, 0.02); |
|---|
| 67 | ++$test; |
|---|
| 68 | |
|---|
| 69 | testFilterCompare('input.miff', q//, 'reference/filter/Set.miff', 'Set', q/page=>'0x0+0+0'/, 0.002, 0.02); |
|---|
| 70 | ++$test; |
|---|
| 71 | |
|---|
| 72 | testFilterCompare('input.miff', q//, 'reference/filter/Despeckle.miff', 'Despeckle', q//, 0.08, 1.08); |
|---|
| 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.002, 0.02); |
|---|
| 76 | ++$test; |
|---|
| 77 | |
|---|
| 78 | testFilterCompare('input.miff', q//, 'reference/filter/Edge.miff', 'Edge', q//, 0.3, 1.03); |
|---|
| 79 | ++$test; |
|---|
| 80 | |
|---|
| 81 | testFilterCompare('input.miff', q//, 'reference/filter/Emboss.miff', 'Emboss', q/'0x1'/, 0.2, 1.02); |
|---|
| 82 | ++$test; |
|---|
| 83 | |
|---|
| 84 | testFilterCompare('input.miff', q//, 'reference/filter/Equalize.miff', 'Equalize', q//, 0.03, 1.03); |
|---|
| 85 | ++$test; |
|---|
| 86 | |
|---|
| 87 | testFilterCompare('input.miff', q//, 'reference/filter/Implode.miff', 'Implode', q/0.5/, 0.002, 0.2); |
|---|
| 88 | ++$test; |
|---|
| 89 | |
|---|
| 90 | testFilterCompare('input.miff', q//, 'reference/filter/Flip.miff', 'Flip', q//, 0.002, 0.02); |
|---|
| 91 | ++$test; |
|---|
| 92 | |
|---|
| 93 | testFilterCompare('input.miff', q//, 'reference/filter/Flop.miff', 'Flop', q//, 0.002, 0.02); |
|---|
| 94 | ++$test; |
|---|
| 95 | |
|---|
| 96 | testFilterCompare('input.miff', q//, 'reference/filter/Frame.miff', 'Frame', q/'15x15+3+3'/, 0.4, 1.04); |
|---|
| 97 | ++$test; |
|---|
| 98 | |
|---|
| 99 | testFilterCompare('input.miff', q//, 'reference/filter/Gamma.miff', 'Gamma', q/1.6/, 0.02, 0.2); |
|---|
| 100 | ++$test; |
|---|
| 101 | |
|---|
| 102 | testFilterCompare('input.miff', q//, 'reference/filter/GaussianBlur.miff', 'GaussianBlur', q/'0.0x1.5'/, 0.004, 0.4); |
|---|
| 103 | ++$test; |
|---|
| 104 | |
|---|
| 105 | testFilterCompare('input.miff', q//, 'reference/filter/Implode.miff', 'Implode', q/0.5/, 0.002, 0.02); |
|---|
| 106 | ++$test; |
|---|
| 107 | |
|---|
| 108 | testFilterCompare('input.miff', q//, 'reference/filter/Level.miff', 'Level', q/'20%'/, 0.2, 1.02); |
|---|
| 109 | ++$test; |
|---|
| 110 | |
|---|
| 111 | testFilterCompare('input.miff', q//, 'reference/filter/Magnify.miff', 'Magnify', q//, 0.002, 0.02); |
|---|
| 112 | ++$test; |
|---|
| 113 | |
|---|
| 114 | testFilterCompare('input.miff', "fuzz=>$fuzz", 'reference/filter/MatteFloodfill.miff', 'MatteFloodfill', q/geometry=>"+25+45"/, 0.002, 0.02); |
|---|
| 115 | ++$test; |
|---|
| 116 | |
|---|
| 117 | testFilterCompare('input.miff', q//, 'reference/filter/MedianFilter.miff', 'MedianFilter', q//, 0.006, 0.6); |
|---|
| 118 | ++$test; |
|---|
| 119 | |
|---|
| 120 | testFilterCompare('input.miff', q//, 'reference/filter/Minify.miff', 'Minify', q//, 0.002, 0.02); |
|---|
| 121 | ++$test; |
|---|
| 122 | |
|---|
| 123 | testFilterCompare('input.miff', q//, 'reference/filter/Modulate.miff', 'Modulate', q/brightness=>110,saturation=>110,hue=>110/, 0.08, 1.08); |
|---|
| 124 | ++$test; |
|---|
| 125 | |
|---|
| 126 | testFilterCompare('input.miff', q//, 'reference/filter/QuantizeMono.miff', 'Quantize', q/colorspace=>'gray',colors=>2,dither=>'false'/, 0.3, 1.03); |
|---|
| 127 | ++$test; |
|---|
| 128 | |
|---|
| 129 | testFilterCompare('input.miff', q//, 'reference/filter/MotionBlur.miff', 'MotionBlur', q/'0x13+10-10'/, 0.003, 0.03); |
|---|
| 130 | ++$test; |
|---|
| 131 | |
|---|
| 132 | testFilterCompare('input.miff', q//, 'reference/filter/Negate.miff', 'Negate', q//, 0.002, 0.02); |
|---|
| 133 | ++$test; |
|---|
| 134 | |
|---|
| 135 | testFilterCompare('input.miff', q//, 'reference/filter/Normalize.miff', 'Normalize', q//, 0.04, 1.04); |
|---|
| 136 | ++$test; |
|---|
| 137 | |
|---|
| 138 | testFilterCompare('input.miff', q//, 'reference/filter/OilPaint.miff', 'OilPaint', q//, 0.03, 1.03); |
|---|
| 139 | ++$test; |
|---|
| 140 | |
|---|
| 141 | testFilterCompare('input.miff', "fuzz=>$fuzz", 'reference/filter/Opaque.miff', 'Opaque', q/color=>"#e23834", fill=>"green"/, 0.03, 1.02); |
|---|
| 142 | ++$test; |
|---|
| 143 | |
|---|
| 144 | testFilterCompare('input.miff', q//, 'reference/filter/Quantize.miff', 'Quantize', q//, 0.03, 1.03); |
|---|
| 145 | ++$test; |
|---|
| 146 | |
|---|
| 147 | testFilterCompare('input.miff', q//, 'reference/filter/RadialBlur.miff', 'RadialBlur', q/10/, 0.002, 0.02); |
|---|
| 148 | ++$test; |
|---|
| 149 | |
|---|
| 150 | testFilterCompare('input.miff', q//, 'reference/filter/Raise.miff', 'Raise', q/'10x10'/, 0.002, 0.02); |
|---|
| 151 | ++$test; |
|---|
| 152 | |
|---|
| 153 | testFilterCompare('input.miff', q//, 'reference/filter/ReduceNoise.miff', 'ReduceNoise', q//, 0.006, 0.6); |
|---|
| 154 | ++$test; |
|---|
| 155 | |
|---|
| 156 | testFilterCompare('input.miff', q//, 'reference/filter/Resize.miff', 'Resize', q/'60%'/, 0.02, 1.02); |
|---|
| 157 | ++$test; |
|---|
| 158 | |
|---|
| 159 | testFilterCompare('input.miff', q//, 'reference/filter/Roll.miff', 'Roll', q/geometry=>'+20+10'/, 0.002, 0.02); |
|---|
| 160 | ++$test; |
|---|
| 161 | |
|---|
| 162 | testFilterCompare('input.miff', q//, 'reference/filter/Rotate.miff', 'Rotate', q/45/, 0.4, 1.02); |
|---|
| 163 | ++$test; |
|---|
| 164 | |
|---|
| 165 | testFilterCompare('input.miff', q//, 'reference/filter/Sample.miff', 'Sample', q/'60%'/, 0.002, 0.02); |
|---|
| 166 | ++$test; |
|---|
| 167 | |
|---|
| 168 | testFilterCompare('input.miff', q//, 'reference/filter/Scale.miff', 'Scale', q/'60%'/, 0.002, 0.02); |
|---|
| 169 | ++$test; |
|---|
| 170 | |
|---|
| 171 | testFilterCompare('input.miff', q//, 'reference/filter/Segment.miff', 'Segment', q//, 0.002, 0.02); |
|---|
| 172 | ++$test; |
|---|
| 173 | |
|---|
| 174 | testFilterCompare('input.miff', q//, 'reference/filter/Shade.miff', 'Shade', q/geometry=>'30x30',gray=>'true'/, 0.002, 0.02); |
|---|
| 175 | ++$test; |
|---|
| 176 | |
|---|
| 177 | testFilterCompare('input.miff', q//, 'reference/filter/Sharpen.miff', 'Sharpen', q/'0.0x1.0'/, 0.05, 1.05); |
|---|
| 178 | ++$test; |
|---|
| 179 | |
|---|
| 180 | testFilterCompare('input.miff', q//, 'reference/filter/Shave.miff', 'Shave', q/'10x10'/, 0.002, 0.02); |
|---|
| 181 | ++$test; |
|---|
| 182 | |
|---|
| 183 | testFilterCompare('input.miff', q//, 'reference/filter/Shear.miff', 'Shear', q/'-20x20'/, 0.4, 1.04); |
|---|
| 184 | ++$test; |
|---|
| 185 | |
|---|
| 186 | testFilterCompare('input.miff', q//, 'reference/filter/SigmoidalContrast.miff', 'SigmoidalContrast', q/"3x50%"/, 0.06, 0.6); |
|---|
| 187 | ++$test; |
|---|
| 188 | |
|---|
| 189 | testFilterCompare('input.miff', q//, 'reference/filter/Solarize.miff', 'Solarize', q//, 0.002, 0.02); |
|---|
| 190 | ++$test; |
|---|
| 191 | |
|---|
| 192 | testFilterCompare('input.miff', q//, 'reference/filter/Swirl.miff', 'Swirl', q/90/, 0.002, 0.2); |
|---|
| 193 | ++$test; |
|---|
| 194 | |
|---|
| 195 | testFilterCompare('input.miff', q//, 'reference/filter/Threshold.miff', 'Threshold', q/90%/, 0.002, 0.02); |
|---|
| 196 | ++$test; |
|---|
| 197 | |
|---|
| 198 | testFilterCompare('input.miff', q//, 'reference/filter/Trim.miff', 'Trim', q//, 0.002, 0.02); |
|---|
| 199 | ++$test; |
|---|
| 200 | |
|---|
| 201 | testFilterCompare('input.miff', q//, 'reference/filter/UnsharpMask.miff', 'UnsharpMask', q/'0.0x1.0'/, 0.02, 1.02); |
|---|
| 202 | ++$test; |
|---|
| 203 | |
|---|
| 204 | testFilterCompare('input.miff', q//, 'reference/filter/Wave.miff', 'Wave', q/'25x150'/, 0.6, 1.06); |
|---|
| 205 | ++$test; |
|---|
| 206 | |
|---|
| 207 | 1; |
|---|