1 #include <iostream> 2 #include <list> 3 #include <algorithm> 4 5 #include <Magick++/Image.h> 6 #include <Magick++/STL.h> 7 getInitializer(const std::string magick_module)8static std::string getInitializer(const std::string magick_module) 9 { 10 if ((magick_module == "BGR") || (magick_module == "CMYK") || (magick_module =="RGB") || (magick_module =="YUV")) 11 return "interlace"; 12 if (magick_module == "PNG") 13 return "png"; 14 return ""; 15 } 16 main()17int main() { 18 std::list<Magick::CoderInfo> coderList; 19 coderInfoList(&coderList, Magick::CoderInfo::TrueMatch, Magick::CoderInfo::AnyMatch, Magick::CoderInfo::AnyMatch); 20 21 std::list<std::string> allowedNames; 22 allowedNames.push_back("BGR"); 23 allowedNames.push_back("BMP"); 24 allowedNames.push_back("CMYK"); 25 allowedNames.push_back("DDS"); 26 allowedNames.push_back("EPT"); 27 allowedNames.push_back("FAX"); 28 allowedNames.push_back("HTML"); 29 allowedNames.push_back("JP2"); 30 allowedNames.push_back("JPEG"); 31 allowedNames.push_back("PCD"); 32 allowedNames.push_back("PCD"); 33 allowedNames.push_back("PDF"); 34 allowedNames.push_back("PNG"); 35 allowedNames.push_back("PS"); 36 allowedNames.push_back("PS2"); 37 allowedNames.push_back("PS3"); 38 allowedNames.push_back("RGB"); 39 allowedNames.push_back("SVG"); 40 allowedNames.push_back("TIFF"); 41 allowedNames.push_back("TXT"); 42 allowedNames.push_back("YCBCR"); 43 44 std::list<std::string> excludeList; 45 excludeList.push_back("GRADIENT"); 46 excludeList.push_back("LABEL"); 47 excludeList.push_back("NULL"); 48 excludeList.push_back("PATTERN"); 49 excludeList.push_back("PLASMA"); 50 excludeList.push_back("SCREENSHOT"); 51 excludeList.push_back("TXT"); 52 excludeList.push_back("XC"); 53 54 for (std::list<Magick::CoderInfo>::iterator it = coderList.begin(); it != coderList.end(); it++) 55 { 56 std::string module=(*it).module(); 57 if (std::find(excludeList.begin(), excludeList.end(), module) != excludeList.end()) 58 continue; 59 60 if ((*it).name() == module) 61 std::cout << ((*it).isWritable() ? "+" : "-") << module << ":" << getInitializer(module) << std::endl; 62 else if (std::find(allowedNames.begin(), allowedNames.end(), module) != allowedNames.end()) 63 std::cout << ((*it).isWritable() ? "+" : "-") << (*it).name() << ":" << getInitializer(module) << std::endl; 64 } 65 } 66