2 // Demonstrate using the 'analyze' process module to compute
5 // Copyright Bob Friesenhahn, 2003, 2004
7 // Usage: analyze file...
15 using namespace Magick;
16 int main(int argc,char **argv)
20 cout << "Usage: " << argv[0] << " file..." << endl;
24 // Initialize ImageMagick install location for Windows
25 InitializeMagick(*argv);
28 std::list<std::string> attributes;
30 attributes.push_back("TopLeftColor");
31 attributes.push_back("TopRightColor");
32 attributes.push_back("BottomLeftColor");
33 attributes.push_back("BottomRightColor");
34 attributes.push_back("filter:brightness:mean");
35 attributes.push_back("filter:brightness:standard-deviation");
36 attributes.push_back("filter:brightness:kurtosis");
37 attributes.push_back("filter:brightness:skewness");
38 attributes.push_back("filter:saturation:mean");
39 attributes.push_back("filter:saturation:standard-deviation");
40 attributes.push_back("filter:saturation:kurtosis");
41 attributes.push_back("filter:saturation:skewness");
43 char **arg = &argv[1];
48 cout << "File: " << fname << endl;
51 /* Analyze module does not require an argument list */
52 image.process("analyze",0,0);
54 list<std::string>::iterator pos = attributes.begin();
55 while(pos != attributes.end())
57 cout << " " << setw(16) << setfill(' ') << setiosflags(ios::left)
58 << *pos << " = " << image.attribute(*pos) << endl;
62 catch( Exception &error_ )
64 cout << error_.what() << endl;