From a2c1203a0cdafee8e89fd116f512e5d96d94d27b Mon Sep 17 00:00:00 2001 From: Lode Date: Thu, 20 Nov 2014 01:01:02 +0100 Subject: predict idat size correctly for interlaced images --- example_png_info.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'example_png_info.cpp') 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 buffer; std::vector 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) -- cgit v1.2.3