diff options
author | Lode <lvandeve@gmail.com> | 2014-11-20 01:01:02 +0100 |
---|---|---|
committer | Lode <lvandeve@gmail.com> | 2014-11-20 01:01:02 +0100 |
commit | a2c1203a0cdafee8e89fd116f512e5d96d94d27b (patch) | |
tree | 660db84a0d5da4a2d83064709236ff985e2b7b2e /example_png_info.cpp | |
parent | b5eb75dc2d7c7f29509b1c0a74b0ab349372e767 (diff) |
predict idat size correctly for interlaced images
Diffstat (limited to 'example_png_info.cpp')
-rw-r--r-- | example_png_info.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/example_png_info.cpp b/example_png_info.cpp index e7f78a2..c6df5c1 100644 --- a/example_png_info.cpp +++ b/example_png_info.cpp @@ -280,12 +280,18 @@ Main */ int main(int argc, char *argv[]) /*list the chunks*/ { - if(argc < 2) + bool ignore_checksums = false; + std::string filename = ""; + for (int i = 1; i < argc; i++) + { + if(std::string(argv[i]) == "--ignore_checksums") ignore_checksums = true; + else filename = argv[i]; + } + if(filename == "") { std::cout << "Please provide a filename to preview" << std::endl; return 0; } - const char* filename = argv[1]; std::vector<unsigned char> buffer; std::vector<unsigned char> image; @@ -294,6 +300,12 @@ int main(int argc, char *argv[]) /*list the chunks*/ lodepng::load_file(buffer, filename); //load the image file with given filename lodepng::State state; + if(ignore_checksums) + { + state.decoder.ignore_crc = 1; + state.decoder.zlibsettings.ignore_adler32 = 1; + } + unsigned error = lodepng::decode(image, w, h, state, buffer); if(error) |