• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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   Wizard the License for the specific language governing permissions and
14   limitations under the License.
15 
16   ImageMagick test vectors.
17 */
18 #ifndef _IMAGEMAGICK_VALIDATE_H
19 #define _IMAGEMAGICK_VALIDATE_H
20 
21 #define ReferenceFilename  "rose:"
22 #define ReferenceImageFormat  "MIFF"
23 
24 static const char
25   *compare_options[] =
26   {
27     "-metric RMSE -fuzz 5%",
28     "-metric AE -fuzz 5%",
29     (const char *) NULL
30   };
31 
32 static const char
33   *composite_options[] =
34   {
35     "",
36     "-compose Atop",
37     "-compose Blend",
38     "-compose Bumpmap",
39     "-compose ChangeMask",
40     "-compose Clear",
41     "-compose ColorBurn",
42     "-compose ColorDodge",
43     "-compose Colorize",
44     "-compose CopyBlack",
45     "-compose CopyBlue",
46     "-compose CopyCyan",
47     "-compose CopyGreen",
48     "-compose Copy",
49     "-compose CopyMagenta",
50     "-compose CopyOpacity",
51     "-compose CopyRed",
52     "-compose CopyYellow",
53     "-compose Darken",
54     "-compose Divide",
55     "-compose Dst",
56     "-compose Difference",
57     "-compose Displace",
58     "-compose Dissolve",
59     "-compose DstAtop",
60     "-compose DstIn",
61     "-compose DstOut",
62     "-compose DstOver",
63     "-compose Dst",
64     "-compose Exclusion",
65     "-compose HardLight",
66     "-compose Hue",
67     "-compose In",
68     "-compose Lighten",
69     "-compose LinearLight",
70     "-compose Luminize",
71     "-compose Minus",
72     "-compose Modulate",
73     "-compose ModulusAdd",
74     "-compose ModulusSubtract",
75     "-compose Multiply",
76     "-compose None",
77     "-compose Out",
78     "-compose Overlay",
79     "-compose Over",
80     "-compose Plus",
81     "-compose Replace",
82     "-compose Saturate",
83     "-compose Screen",
84     "-compose SoftLight",
85     "-compose Src",
86     "-compose SrcAtop",
87     "-compose SrcIn",
88     "-compose SrcOut",
89     "-compose SrcOver",
90     "-compose Src",
91     "-compose Threshold",
92     "-compose Xor",
93     "-geometry +35+65 -label Magick",
94     (const char *) NULL
95   };
96 
97 static const char
98   *convert_options[] =
99   {
100     "",
101     "-affine 1,0,0.785,1,0,0 -transform",
102     "-black-threshold 20%",
103     "-blur 0x0.5",
104     "-blur 0x1.0",
105     "-blur 0x2.0",
106     "-border 6x6",
107     "-canny 0x1+10%+80%",
108     "-channel red",
109     "-charcoal 0x1",
110     "-chop 80x60+10+20",
111     "-chop 8x6+20+30",
112     "-colorize 30%/20%/50%",
113     "-color-matrix '0,0,1,0,1,0,1,0,0'",
114     "-color-matrix '0.9 0 0, 0 0.9 0, 0 0 1.2'",
115     "-color-matrix '0.9,0,0,0,0.9,0,0,0,1.2'",
116     "-color-matrix '1,0,0,0,1,0,0,0,1'",
117     "-color-matrix '.22,.72,.07,.22,.72,.07,.22,.72,.07'",
118     "-colors 16",
119     "-colorspace CMYK",
120     "-colorspace GRAY",
121     "-colorspace HSL",
122     "-colorspace HWB",
123     "-colorspace OHTA",
124     "-colorspace YCbCr",
125     "-colorspace YIQ",
126     "-colorspace YUV",
127     "+contrast +contrast +contrast",
128     "-contrast -contrast -contrast",
129     "+contrast",
130     "-contrast",
131     "-convolve 1,1,1,1,4,1,1,1,1",
132     "-crop 17x9+10+10",
133     "-crop 60x70+10+10",
134     "-cycle 200",
135     "-density 75x75 -resample 50x50",
136     "-despeckle",
137     "-draw \"rectangle 20,10 80,50\"",
138     "-edge 0x1",
139     "-emboss 0x1",
140     "-enhance",
141     "-equalize",
142     "-evaluate Abs 2%",
143     "-evaluate Add 233",
144     "-evaluate AddModulus 50%",
145     "-evaluate And 6",
146     "-evaluate Cosine 2",
147     "-evaluate Divide 0.7",
148     "-evaluate Exponential 1.0",
149     "-evaluate InverseLog 2",
150     "-evaluate Xor 233",
151     "-extent 1200x1200-100-100",
152     "-fill blue -fuzz 35% -opaque red",
153     "-fill blue -stroke gold -draw 'Bezier 400,200 1100,800 100,300'",
154     "-fill blue -stroke gold -draw 'polygon 400,200 1100,800 100,300'",
155     "-fill blue -stroke gold -draw 'rectangle 400,200 1100,800'",
156     "-fill blue -stroke gold -draw 'roundRectangle 400,200 1100,800 20,20'",
157     "-fill green -stroke gold -draw 'circle 800,500 1100,800'",
158     "-fill none -stroke gold -draw 'Bezier 400,200 1100,800 100,300'",
159     "-fill none -stroke gold -draw 'circle 800,500 1100,800'",
160     "-fill none -stroke gold -draw 'polygon 400,200 1100,800 100,300'",
161     "-fill none -stroke gold -draw 'rectangle 400,200 1100,800'",
162     "-fill none -stroke gold -draw 'roundRectangle 400,200 1100,800 20,20'",
163     "-flip",
164     "-flop",
165     "-frame 15x15+3+3",
166     "-fuzz 35% -transparent red",
167     "-fuzz 5% -trim",
168     "-fx \"(1.0/(1.0+exp(10.0*(0.5-u)))-0.006693)*1.0092503\"",
169     "-gamma 1.6",
170     "-gaussian 0x0.5",
171     "-gaussian 0x1.0",
172     "-gaussian 0x2.0",
173     "-implode 0.5",
174     "-implode -1",
175     "-label Magick",
176     "-lat 10x10-5%",
177     "-level 10%,1.2,90%",
178     "-magnify",
179     "-map netscape:",
180     "-median 1",
181     "-median 2",
182     "-modulate 110/100/95",
183     "-monochrome",
184     "-motion-blur 0x3+30",
185     "-negate",
186     "-noise 1",
187     "-noise 2",
188     "+noise Gaussian",
189     "+noise Impulse",
190     "+noise Laplacian",
191     "+noise Multiplicative",
192     "+noise Poisson",
193     "+noise Random",
194     "+noise Uniform",
195     "-noop",
196     "-normalize",
197     "-ordered-dither 2x2",
198     "-ordered-dither 3x3",
199     "-ordered-dither 4x4",
200     "-paint 0x1",
201     "-raise 10x10",
202     "-random-threshold 10%",
203     "-random-threshold 20x80",
204     "-resize 100%",
205     "-resize 10%",
206     "-resize 150%",
207     "-resize 150x75%",
208     "-resize 50%",
209     "-resize 50x150%",
210     "-roll +20+10",
211     "-rotate 0",
212     "-rotate 15",
213     "-rotate 180",
214     "-rotate 270",
215     "-rotate 45",
216     "-rotate 90",
217     "-sample 100%",
218     "-sample 150%",
219     "-sample 150x50%",
220     "-sample 50%",
221     "-sample 50x150%",
222     "-sample 5%",
223     "-scale 100%",
224     "-scale 150%",
225     "-scale 150x50%",
226     "-scale 50%",
227     "-scale 50x150%",
228     "-scale 5%",
229     "-segment 0.5x0.25",
230     "-segment 1x1.5",
231     "-shade 30x30",
232     "-sharpen 0x0.5",
233     "-sharpen 0x1.0",
234     "-sharpen 0x2.0",
235     "-shave 10x10",
236     "-shear 25x20",
237     "-shear 45x45",
238     "-size 130x194",
239     "-solarize 50%",
240     "-spread 1",
241     "-spread 3",
242     "-swirl 90",
243     "-threshold 35%",
244     "-trim",
245     "-unsharp 0x0.5+20+1",
246     "-unsharp 0x1.0+20+1",
247     "-wave 25x150",
248     "-white-threshold 80%",
249     (const char *) NULL
250   };
251 
252 static const char
253   *identify_options[] =
254   {
255     "",
256     "-verbose",
257     "-features 1 -verbose",
258     "-unique -verbose",
259     (const char *) NULL
260   };
261 
262 static const char
263   *montage_options[] =
264   {
265     "",
266     "-frame 5",
267     "-geometry 13x19+10+5 -gravity Center",
268     "-label %f",
269     "-pointsize 10",
270     "-shadow",
271     "-tile 3x3",
272     (const char *) NULL
273   };
274 
275 static const char
276   *stream_options[] =
277   {
278     "",
279     (const char *) NULL
280   };
281 
282 struct ReferenceFormats
283 {
284   const char
285     *magick;
286 
287   CompressionType
288     compression;
289 
290   double
291     fuzz;
292 };
293 
294 static const struct ReferenceFormats
295   reference_formats[] =
296   {
297     { "ART", UndefinedCompression, 0.0 },
298     { "AVS", UndefinedCompression, 0.0 },
299     { "BMP", UndefinedCompression, 0.0 },
300     { "BMP2", UndefinedCompression, 0.0 },
301     { "BMP3", UndefinedCompression, 0.0 },
302     { "CIN", UndefinedCompression, 0.0 },
303     { "CMYK", UndefinedCompression, 0.0 },
304     { "CMYKA", UndefinedCompression, 0.0 },
305     { "CUT", UndefinedCompression, 0.0 },
306     { "DCM", UndefinedCompression, 0.0 },
307     { "DCR", UndefinedCompression, 0.0 },
308     { "DCX", UndefinedCompression, 0.0 },
309     { "DDS", UndefinedCompression, 0.0 },
310     { "DFONT", UndefinedCompression, 0.0 },
311     { "DJVU", UndefinedCompression, 0.0 },
312     { "DNG", UndefinedCompression, 0.0 },
313     { "DOT", UndefinedCompression, 0.0 },
314     { "DPS", UndefinedCompression, 0.0 },
315     { "DPX", UndefinedCompression, 0.004 },
316     { "ERF", UndefinedCompression, 0.0 },
317     { "EXR", UndefinedCompression, 0.0 },
318     { "FPX", UndefinedCompression, 0.0 },
319     { "FRACTAL", UndefinedCompression, 0.0 },
320     { "GIF", UndefinedCompression, 0.0 },
321     { "GIF87", UndefinedCompression, 0.0 },
322     { "GRAY", UndefinedCompression, 0.004 },
323     { "HTM", UndefinedCompression, 0.0 },
324     { "HTML", UndefinedCompression, 0.0 },
325     { "ICB", UndefinedCompression, 0.0 },
326     { "ICO", UndefinedCompression, 0.0 },
327     { "ICON", UndefinedCompression, 0.0 },
328     { "INFO", UndefinedCompression, 0.0 },
329     { "JBG", UndefinedCompression, 0.0 },
330     { "JNG", UndefinedCompression, 0.004 },
331     { "JNG", JPEGCompression, 0.004 },
332     { "JP2", UndefinedCompression, 0.004 },
333     { "J2K", UndefinedCompression, 0.004 },
334     { "JPEG", UndefinedCompression, 0.004 },
335     { "JPG", UndefinedCompression, 0.004 },
336     { "K25", UndefinedCompression, 0.0 },
337     { "KDC", UndefinedCompression, 0.0 },
338     { "MATTE", UndefinedCompression, 0.0 },
339     { "MIFF", UndefinedCompression, 0.0 },
340     { "MIFF", RLECompression, 0.0 },
341     { "MIFF", ZipCompression, 0.0 },
342     { "MNG", UndefinedCompression, 0.0 },
343     { "MONO", UndefinedCompression, 0.0 },
344     { "MRW", UndefinedCompression, 0.0 },
345     { "MTV", UndefinedCompression, 0.0 },
346     { "NEF", UndefinedCompression, 0.0 },
347     { "ORF", UndefinedCompression, 0.0 },
348     { "OTB", UndefinedCompression, 0.0 },
349     { "OTF", UndefinedCompression, 0.0 },
350     { "PAL", UndefinedCompression, 0.0 },
351     { "PAM", UndefinedCompression, 0.0 },
352     { "PBM", UndefinedCompression, 0.0 },
353     { "PCT", UndefinedCompression, 0.004 },
354     { "PCX", UndefinedCompression, 0.0 },
355     { "PEF", UndefinedCompression, 0.0 },
356     { "PFA", UndefinedCompression, 0.0 },
357     { "PFB", UndefinedCompression, 0.0 },
358     { "PFM", UndefinedCompression, 0.004 },
359     { "PGM", UndefinedCompression, 0.0 },
360     { "PGX", UndefinedCompression, 0.0 },
361     { "PICT", UndefinedCompression, 0.004 },
362     { "PIX", UndefinedCompression, 0.0 },
363     { "PJPEG", UndefinedCompression, 0.004 },
364     { "PLASMA", UndefinedCompression, 0.0 },
365     { "PNG", UndefinedCompression, 0.0 },
366     { "PNG8", UndefinedCompression, 0.0 },
367     { "PNG24", UndefinedCompression, 0.0 },
368     { "PNG32", UndefinedCompression, 0.0 },
369     { "PNG48", UndefinedCompression, 0.0 },
370     { "PNG64", UndefinedCompression, 0.0 },
371     { "PNG00", UndefinedCompression, 0.0 },
372     { "PNM", UndefinedCompression, 0.0 },
373     { "PPM", UndefinedCompression, 0.0 },
374     { "PREVIEW", UndefinedCompression, 0.0 },
375     { "PTIF", UndefinedCompression, 0.0 },
376     { "PWP", UndefinedCompression, 0.0 },
377     { "RADIAL-GR", UndefinedCompression, 0.0 },
378     { "RAF", UndefinedCompression, 0.0 },
379     { "RAS", UndefinedCompression, 0.0 },
380     { "RGB", UndefinedCompression, 0.0 },
381     { "RGBA", UndefinedCompression, 0.004 },
382     { "RGBO", UndefinedCompression, 0.004 },
383     { "RLA", UndefinedCompression, 0.0 },
384     { "RLE", UndefinedCompression, 0.0 },
385     { "SCR", UndefinedCompression, 0.0 },
386     { "SCT", UndefinedCompression, 0.0 },
387     { "SFW", UndefinedCompression, 0.0 },
388     { "SGI", UndefinedCompression, 0.0 },
389     { "SHTML", UndefinedCompression, 0.0 },
390     { "SR2", UndefinedCompression, 0.0 },
391     { "SRF", UndefinedCompression, 0.0 },
392     { "STEGANO", UndefinedCompression, 0.0 },
393     { "SUN", UndefinedCompression, 0.0 },
394     { "TGA", UndefinedCompression, 0.0 },
395     { "TIFF", UndefinedCompression, 0.0 },
396     { "TIFF64", UndefinedCompression, 0.0 },
397     { "TILE", UndefinedCompression, 0.0 },
398     { "TIM", UndefinedCompression, 0.0 },
399     { "TIM2", UndefinedCompression, 0.0 },
400     { "TTC", UndefinedCompression, 0.0 },
401     { "TTF", UndefinedCompression, 0.0 },
402     { "TXT", UndefinedCompression, 0.0 },
403     { "UIL", UndefinedCompression, 0.0 },
404     { "UYVY", UndefinedCompression, 0.0 },
405     { "VDA", UndefinedCompression, 0.0 },
406     { "VICAR", UndefinedCompression, 0.0 },
407     { "VIFF", UndefinedCompression, 0.004 },
408     { "VST", UndefinedCompression, 0.0 },
409     { "WBMP", UndefinedCompression, 0.0 },
410     { "WPG", UndefinedCompression, 0.0 },
411     { "X3F", UndefinedCompression, 0.0 },
412     { "XBM", UndefinedCompression, 0.0 },
413     { "XCF", UndefinedCompression, 0.0 },
414     { "XPM", UndefinedCompression, 0.004 },
415     { "XPS", UndefinedCompression, 0.0 },
416     { "XV", UndefinedCompression, 0.004 },
417 #if !defined(MAGICKCORE_WINDOWS_SUPPORT)
418     { "XWD", UndefinedCompression, 0.0 },
419 #endif
420     { "YUV", UndefinedCompression, 0.0 },
421     { "YCbCr", UndefinedCompression, 0.0 },
422     { "YCbCrA", UndefinedCompression, 0.0 },
423 #if defined(MAGICKCORE_GS_DELEGATE)
424     { "AI", UndefinedCompression, 0.0 },
425     { "EPDF", UndefinedCompression, 0.0 },
426     { "EPI", UndefinedCompression, 0.0 },
427     { "EPS", UndefinedCompression, 0.0 },
428     { "EPS2", UndefinedCompression, 0.0 },
429     { "EPS3", UndefinedCompression, 0.0 },
430     { "EPSF", UndefinedCompression, 0.0 },
431     { "EPSI", UndefinedCompression, 0.0 },
432     { "EPT", UndefinedCompression, 0.0 },
433     { "PDF", UndefinedCompression, 0.0 },
434     { "PDF", ZipCompression, 0.0 },
435     { "PDF", FaxCompression, 0.0 },
436     { "PDF", JPEGCompression, 0.004 },
437     { "PDF", RLECompression, 0.0 },
438     { "PDF", LZWCompression, 0.0 },
439     { "PDFA", UndefinedCompression, 0.0 },
440     { "PS", UndefinedCompression, 0.0 },
441     { "PS2", UndefinedCompression, 0.0 },
442     { "PS3", UndefinedCompression, 0.0 },
443     { "PS3", ZipCompression, 0.0 },
444     { "PS3", FaxCompression, 0.0 },
445     { "PS3", JPEGCompression, 0.004 },
446     { "PS3", RLECompression, 0.0 },
447     { "PS3", LZWCompression, 0.0 },
448 #endif
449     { (const char *) NULL, UndefinedCompression, 0.0 }
450   };
451 
452 static const char
453   *reference_map[] =
454   {
455     "bgro",
456     "bgrp",
457     "bgr",
458     "cmyk",
459     "cmy",
460     "i",
461     "prgb",
462     "rgba",
463     "rgbo",
464     "rgb",
465     (char *) NULL
466   };
467 
468 struct ReferenceStorage
469 {
470   StorageType
471     type;
472 
473   size_t
474     quantum;
475 };
476 
477 static const struct ReferenceStorage
478   reference_storage[] =
479   {
480     { CharPixel, sizeof(unsigned char) },
481     { DoublePixel, sizeof(double) },
482     { FloatPixel, sizeof(float) },
483     { LongPixel, sizeof(unsigned int) },
484     { LongLongPixel, sizeof(MagickSizeType) },
485     { ShortPixel, sizeof(unsigned short) },
486     { UndefinedPixel, 0 }
487   };
488 
489 struct ReferenceTypes
490 {
491   ImageType
492     type;
493 
494   size_t
495     depth;
496 };
497 
498 static const struct ReferenceTypes
499   reference_types[] =
500   {
501     { TrueColorType, 8 },
502     { TrueColorAlphaType, 8 },
503     { GrayscaleType, 8 },
504     { GrayscaleAlphaType, 8 },
505     { PaletteType, 8 },
506     { PaletteAlphaType, 8 },
507     { PaletteBilevelAlphaType, 8 },
508     { BilevelType, 1 },
509     { ColorSeparationType, 8 },
510     { ColorSeparationAlphaType, 8 },
511     { TrueColorType, 10 },
512     { TrueColorType, 12 },
513     { TrueColorType, 16 },
514     { UndefinedType, 0 }
515   };
516 
517 #endif
518