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 Add",
37     "-compose Atop",
38     "-compose Blend",
39     "-compose Bumpmap",
40     "-compose ChangeMask",
41     "-compose Clear",
42     "-compose ColorBurn",
43     "-compose ColorDodge",
44     "-compose Colorize",
45     "-compose CopyBlack",
46     "-compose CopyBlue",
47     "-compose CopyCyan",
48     "-compose CopyGreen",
49     "-compose Copy",
50     "-compose CopyMagenta",
51     "-compose CopyOpacity",
52     "-compose CopyRed",
53     "-compose CopyYellow",
54     "-compose Darken",
55     "-compose Divide",
56     "-compose Dst",
57     "-compose Difference",
58     "-compose Displace",
59     "-compose Dissolve",
60     "-compose DstAtop",
61     "-compose DstIn",
62     "-compose DstOut",
63     "-compose DstOver",
64     "-compose Dst",
65     "-compose Exclusion",
66     "-compose HardLight",
67     "-compose Hue",
68     "-compose In",
69     "-compose Lighten",
70     "-compose LinearLight",
71     "-compose Luminize",
72     "-compose Minus",
73     "-compose Modulate",
74     "-compose Multiply",
75     "-compose None",
76     "-compose Out",
77     "-compose Overlay",
78     "-compose Over",
79     "-compose Plus",
80     "-compose Replace",
81     "-compose Saturate",
82     "-compose Screen",
83     "-compose SoftLight",
84     "-compose Src",
85     "-compose SrcAtop",
86     "-compose SrcIn",
87     "-compose SrcOut",
88     "-compose SrcOver",
89     "-compose Src",
90     "-compose Subtract",
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     "-paint 0x1",
198     "-raise 10x10",
199     "-random-threshold 10%",
200     "-random-threshold 20x80",
201     "-resize 100%",
202     "-resize 10%",
203     "-resize 150%",
204     "-resize 150x75%",
205     "-resize 50%",
206     "-resize 50x150%",
207     "-roll +20+10",
208     "-rotate 0",
209     "-rotate 15",
210     "-rotate 180",
211     "-rotate 270",
212     "-rotate 45",
213     "-rotate 90",
214     "-sample 100%",
215     "-sample 150%",
216     "-sample 150x50%",
217     "-sample 50%",
218     "-sample 50x150%",
219     "-sample 5%",
220     "-scale 100%",
221     "-scale 150%",
222     "-scale 150x50%",
223     "-scale 50%",
224     "-scale 50x150%",
225     "-scale 5%",
226     "-segment 0.5x0.25",
227     "-segment 1x1.5",
228     "-shade 30x30",
229     "-sharpen 0x0.5",
230     "-sharpen 0x1.0",
231     "-sharpen 0x2.0",
232     "-shave 10x10",
233     "-shear 25x20",
234     "-shear 45x45",
235     "-size 130x194",
236     "-solarize 50%",
237     "-spread 1",
238     "-spread 3",
239     "-swirl 90",
240     "-threshold 35%",
241     "-trim",
242     "-unsharp 0x0.5+20+1",
243     "-unsharp 0x1.0+20+1",
244     "-wave 25x150",
245     "-white-threshold 80%",
246     (const char *) NULL
247   };
248 
249 static const char
250   *identify_options[] =
251   {
252     "",
253     "-verbose",
254     "-features 1 -verbose",
255     "-unique -verbose",
256     (const char *) NULL
257   };
258 
259 static const char
260   *montage_options[] =
261   {
262     "",
263     "-frame 5",
264     "-geometry 13x19+10+5 -gravity Center",
265     "-label %f",
266     "-pointsize 10",
267     "-shadow",
268     "-tile 3x3",
269     (const char *) NULL
270   };
271 
272 static const char
273   *stream_options[] =
274   {
275     "",
276     (const char *) NULL
277   };
278 
279 struct ReferenceFormats
280 {
281   const char
282     *magick;
283 
284   CompressionType
285     compression;
286 
287   double
288     fuzz;
289 };
290 
291 static const struct ReferenceFormats
292   reference_formats[] =
293   {
294     { "ART", UndefinedCompression, 0.0 },
295     { "AVS", UndefinedCompression, 0.0 },
296     { "BMP", UndefinedCompression, 0.0 },
297     { "BMP2", UndefinedCompression, 0.0 },
298     { "BMP3", UndefinedCompression, 0.0 },
299     { "CIN", UndefinedCompression, 0.0 },
300     { "CMYK", UndefinedCompression, 0.0 },
301     { "CMYKA", UndefinedCompression, 0.0 },
302     { "CUT", UndefinedCompression, 0.0 },
303     { "DCM", UndefinedCompression, 0.0 },
304     { "DCR", UndefinedCompression, 0.0 },
305     { "DCX", UndefinedCompression, 0.0 },
306     { "DDS", UndefinedCompression, 0.0 },
307     { "DFONT", UndefinedCompression, 0.0 },
308     { "DJVU", UndefinedCompression, 0.0 },
309     { "DNG", UndefinedCompression, 0.0 },
310     { "DOT", UndefinedCompression, 0.0 },
311     { "DPS", UndefinedCompression, 0.0 },
312     { "DPX", UndefinedCompression, 0.004 },
313     { "ERF", UndefinedCompression, 0.0 },
314     { "EXR", UndefinedCompression, 0.0 },
315     { "FPX", UndefinedCompression, 0.0 },
316     { "FRACTAL", UndefinedCompression, 0.0 },
317     { "GIF", UndefinedCompression, 0.0 },
318     { "GIF87", UndefinedCompression, 0.0 },
319     { "GRAY", UndefinedCompression, 0.004 },
320     { "HRZ", UndefinedCompression, 0.0 },
321     { "HTM", UndefinedCompression, 0.0 },
322     { "HTML", UndefinedCompression, 0.0 },
323     { "ICB", UndefinedCompression, 0.0 },
324     { "ICO", UndefinedCompression, 0.0 },
325     { "ICON", UndefinedCompression, 0.0 },
326     { "INFO", UndefinedCompression, 0.0 },
327     { "JBG", UndefinedCompression, 0.0 },
328     { "JNG", UndefinedCompression, 0.004 },
329     { "JNG", JPEGCompression, 0.004 },
330     { "JP2", UndefinedCompression, 0.004 },
331     { "J2K", UndefinedCompression, 0.004 },
332     { "JPEG", UndefinedCompression, 0.004 },
333     { "JPG", UndefinedCompression, 0.004 },
334     { "K25", UndefinedCompression, 0.0 },
335     { "KDC", UndefinedCompression, 0.0 },
336     { "MATTE", UndefinedCompression, 0.0 },
337     { "MIFF", UndefinedCompression, 0.0 },
338     { "MIFF", RLECompression, 0.0 },
339     { "MIFF", ZipCompression, 0.0 },
340     { "MNG", UndefinedCompression, 0.0 },
341     { "MONO", UndefinedCompression, 0.0 },
342     { "MRW", UndefinedCompression, 0.0 },
343     { "MTV", UndefinedCompression, 0.0 },
344     { "NEF", UndefinedCompression, 0.0 },
345     { "ORF", UndefinedCompression, 0.0 },
346     { "OTB", UndefinedCompression, 0.0 },
347     { "OTF", UndefinedCompression, 0.0 },
348     { "PAL", UndefinedCompression, 0.0 },
349     { "PAM", UndefinedCompression, 0.0 },
350     { "PBM", UndefinedCompression, 0.0 },
351     { "PCT", UndefinedCompression, 0.004 },
352     { "PCX", UndefinedCompression, 0.0 },
353     { "PEF", UndefinedCompression, 0.0 },
354     { "PFA", UndefinedCompression, 0.0 },
355     { "PFB", UndefinedCompression, 0.0 },
356     { "PFM", UndefinedCompression, 0.004 },
357     { "PGM", UndefinedCompression, 0.0 },
358     { "PGX", UndefinedCompression, 0.0 },
359 #if !defined(MAGICKCORE_HDRI_SUPPORT)
360     { "PICT", UndefinedCompression, 0.004 },
361 #endif
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     { "TTC", UndefinedCompression, 0.0 },
400     { "TTF", UndefinedCompression, 0.0 },
401     { "TXT", UndefinedCompression, 0.0 },
402     { "UIL", UndefinedCompression, 0.0 },
403     { "UYVY", UndefinedCompression, 0.0 },
404     { "VDA", UndefinedCompression, 0.0 },
405     { "VICAR", UndefinedCompression, 0.0 },
406     { "VIFF", UndefinedCompression, 0.004 },
407     { "VST", UndefinedCompression, 0.0 },
408     { "WBMP", UndefinedCompression, 0.0 },
409     { "WPG", UndefinedCompression, 0.0 },
410     { "X3F", UndefinedCompression, 0.0 },
411     { "XBM", UndefinedCompression, 0.0 },
412     { "XCF", UndefinedCompression, 0.0 },
413     { "XPM", UndefinedCompression, 0.004 },
414     { "XPS", UndefinedCompression, 0.0 },
415     { "XV", UndefinedCompression, 0.004 },
416 #if !defined(MAGICKCORE_WINDOWS_SUPPORT)
417     { "XWD", UndefinedCompression, 0.0 },
418 #endif
419     { "YUV", UndefinedCompression, 0.0 },
420     { "YCbCr", UndefinedCompression, 0.0 },
421     { "YCbCrA", UndefinedCompression, 0.0 },
422 #if defined(MAGICKCORE_GS_DELEGATE)
423     { "AI", UndefinedCompression, 0.0 },
424     { "EPDF", UndefinedCompression, 0.0 },
425     { "EPI", UndefinedCompression, 0.0 },
426     { "EPS", UndefinedCompression, 0.0 },
427     { "EPS2", UndefinedCompression, 0.0 },
428     { "EPS3", UndefinedCompression, 0.0 },
429     { "EPSF", UndefinedCompression, 0.0 },
430     { "EPSI", UndefinedCompression, 0.0 },
431     { "EPT", UndefinedCompression, 0.0 },
432     { "PDF", UndefinedCompression, 0.0 },
433     { "PDF", ZipCompression, 0.0 },
434     { "PDF", FaxCompression, 0.0 },
435     { "PDF", JPEGCompression, 0.004 },
436     { "PDF", RLECompression, 0.0 },
437     { "PDF", LZWCompression, 0.0 },
438     { "PDFA", UndefinedCompression, 0.0 },
439     { "PS", UndefinedCompression, 0.0 },
440     { "PS2", UndefinedCompression, 0.0 },
441     { "PS3", UndefinedCompression, 0.0 },
442     { "PS3", ZipCompression, 0.0 },
443     { "PS3", FaxCompression, 0.0 },
444     { "PS3", JPEGCompression, 0.004 },
445     { "PS3", RLECompression, 0.0 },
446     { "PS3", LZWCompression, 0.0 },
447 #endif
448     { (const char *) NULL, UndefinedCompression, 0.0 }
449   };
450 
451 static const char
452   *reference_map[] =
453   {
454     "bgro",
455     "bgrp",
456     "bgr",
457     "cmyk",
458     "cmy",
459     "i",
460     "prgb",
461     "rgba",
462     "rgbo",
463     "rgb",
464     (char *) NULL
465   };
466 
467 struct ReferenceStorage
468 {
469   StorageType
470     type;
471 
472   size_t
473     quantum;
474 };
475 
476 static const struct ReferenceStorage
477   reference_storage[] =
478   {
479     { CharPixel, sizeof(unsigned char) },
480     { DoublePixel, sizeof(double) },
481     { FloatPixel, sizeof(float) },
482     { IntegerPixel, sizeof(unsigned int) },
483     { LongPixel, sizeof(size_t) },
484     { ShortPixel, sizeof(unsigned short) },
485     { UndefinedPixel, 0 }
486   };
487 
488 struct ReferenceTypes
489 {
490   ImageType
491     type;
492 
493   size_t
494     depth;
495 };
496 
497 static const struct ReferenceTypes
498   reference_types[] =
499   {
500     { TrueColorType, 8 },
501     { TrueColorMatteType, 8 },
502     { GrayscaleType, 8 },
503     { GrayscaleMatteType, 8 },
504     { PaletteType, 8 },
505     { PaletteMatteType, 8 },
506     { PaletteBilevelMatteType, 8 },
507     { BilevelType, 1 },
508     { ColorSeparationType, 8 },
509     { ColorSeparationMatteType, 8 },
510     { TrueColorType, 10 },
511     { TrueColorType, 12 },
512     { TrueColorType, 16 },
513     { UndefinedType, 0 }
514   };
515 
516 #endif
517