diff options
author | Lode <lvandeve@gmail.com> | 2018-08-10 03:19:41 +0300 |
---|---|---|
committer | Lode <lvandeve@gmail.com> | 2018-08-10 03:19:41 +0300 |
commit | 01ccad80e7241101db499029b71ba1c0bb456240 (patch) | |
tree | 77fa645efbc3f596c07758250c318d8de4d2070c /pngdetail.cpp | |
parent | 955a04e517c1ec266f77f28a89a51d8041a4f1a0 (diff) |
add color profile chunk support to LodePNG
Diffstat (limited to 'pngdetail.cpp')
-rw-r--r-- | pngdetail.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/pngdetail.cpp b/pngdetail.cpp index d52a763..6875bec 100644 --- a/pngdetail.cpp +++ b/pngdetail.cpp @@ -51,6 +51,7 @@ everything except huge output: #include <map> #include <sstream> #include <algorithm> +#include <stdio.h> struct Options { @@ -140,6 +141,34 @@ void displayPNGInfo(const LodePNGInfo& info, const Options& options) << ", " << info.background_b << std::endl; } } + if(info.gama_defined) + { + std::cout << "gAMA defined: " << info.gama_gamma << " (" << (info.gama_gamma / 100000.0) + << ", " << (100000.0 / info.gama_gamma) << ")" << std::endl; + } + if(info.chrm_defined) + { + std::cout << "cHRM defined: " << (info.chrm_white_x / 100000.0) << " " << (info.chrm_white_y / 100000.0) << " " + << (info.chrm_red_x / 100000.0) << " " << (info.chrm_red_y / 100000.0) << " " + << (info.chrm_green_x / 100000.0) << " " << (info.chrm_green_y / 100000.0) << " " + << (info.chrm_blue_x / 100000.0) << " " << (info.chrm_blue_y / 100000.0) << std::endl; + } + if(info.srgb_defined) + { + std::cout << "sRGB defined: rendering intent: " << info.srgb_intent << std::endl; + } + if(info.iccp_defined) + { + std::cout << "iCCP defined: " << info.iccp_name << std::endl; + std::cout << "iCCP profile size: " << info.iccp_profile_size << std::endl; + for(size_t i = 0; i < info.iccp_profile_size; i++) { + unsigned char c = info.iccp_profile[i]; + if(c > 32 && c < 127) printf(" %c ", c); + else printf("%02x ", c); + if(i % 80 == 79 && i + 1 != info.iccp_profile_size) std::cout << std::endl; + } + std::cout << std::endl; + } std::cout << "Interlace method: " << info.interlace_method << std::endl; if(options.show_extra_png_info) std::cout << "Texts: " << info.text_num << std::endl; for(size_t i = 0; i < info.text_num; i++) |