| 1 | /* |
| 2 | Copyright @ 2018 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/license/ |
| 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 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include <iostream> |
| 18 | #include <list> |
| 19 | #include <algorithm> |
| 20 | |
| 21 | #include <Magick++/Image.h> |
| 22 | #include <Magick++/Functions.h> |
| 23 | #include <Magick++/STL.h> |
| 24 | |
| 25 | static std::string getInitializer(const std::string magick_module) |
| 26 | { |
| 27 | if ((magick_module == "BGR") || (magick_module == "CMYK") || (magick_module =="RGB") || (magick_module =="YUV")) |
| 28 | return "interlace"; |
| 29 | if (magick_module == "PNG") |
| 30 | return "png"; |
| 31 | return ""; |
| 32 | } |
| 33 | |
| 34 | int main() |
| 35 | { |
| 36 | Magick::InitializeMagick((const char *) NULL); |
| 37 | |
| 38 | std::list<Magick::CoderInfo> coderList; |
| 39 | coderInfoList(&coderList, Magick::CoderInfo::TrueMatch, Magick::CoderInfo::AnyMatch, Magick::CoderInfo::AnyMatch); |
| 40 | |
| 41 | std::list<std::string> allowedNames; |
| 42 | allowedNames.push_back("BGR"); |
| 43 | allowedNames.push_back("BMP"); |
| 44 | allowedNames.push_back("CMYK"); |
| 45 | allowedNames.push_back("DDS"); |
| 46 | allowedNames.push_back("EPT"); |
| 47 | allowedNames.push_back("FAX"); |
| 48 | allowedNames.push_back("HTML"); |
| 49 | allowedNames.push_back("JP2"); |
| 50 | allowedNames.push_back("JPEG"); |
| 51 | allowedNames.push_back("PCD"); |
| 52 | allowedNames.push_back("PCD"); |
| 53 | allowedNames.push_back("PDF"); |
| 54 | allowedNames.push_back("PNG"); |
| 55 | allowedNames.push_back("PS"); |
| 56 | allowedNames.push_back("PS2"); |
| 57 | allowedNames.push_back("PS3"); |
| 58 | allowedNames.push_back("RGB"); |
| 59 | allowedNames.push_back("SVG"); |
| 60 | allowedNames.push_back("TIFF"); |
| 61 | allowedNames.push_back("TXT"); |
| 62 | allowedNames.push_back("YCBCR"); |
| 63 | |
| 64 | std::list<std::string> excludeList; |
| 65 | excludeList.push_back("GRADIENT"); |
| 66 | excludeList.push_back("LABEL"); |
| 67 | excludeList.push_back("NULL"); |
| 68 | excludeList.push_back("PATTERN"); |
| 69 | excludeList.push_back("PLASMA"); |
| 70 | excludeList.push_back("SCREENSHOT"); |
| 71 | excludeList.push_back("TXT"); |
| 72 | excludeList.push_back("XC"); |
| 73 | |
| 74 | for (std::list<Magick::CoderInfo>::iterator it = coderList.begin(); it != coderList.end(); it++) |
| 75 | { |
| 76 | std::string module=(*it).module(); |
| 77 | if (std::find(excludeList.begin(), excludeList.end(), module) != excludeList.end()) |
| 78 | continue; |
| 79 | |
| 80 | if ((*it).name() == module) |
| 81 | std::cout << ((*it).isWritable() ? "+" : "-") << module << ":" << getInitializer(module) << std::endl; |
| 82 | else if (std::find(allowedNames.begin(), allowedNames.end(), module) != allowedNames.end()) |
| 83 | std::cout << ((*it).isWritable() ? "+" : "-") << (*it).name() << ":" << getInitializer(module) << std::endl; |
| 84 | } |
| 85 | } |