
2011/3/14 Szymon Gatner <szymon.gatner@gmail.com>:
2011/3/8 Christian Henning <chhenning@gmail.com>:
Here is the code I tried:
#include <boost/gil/gil_all.hpp>
#define BOOST_FILESYSTEM_VERSION 2 #include <boost/filesystem/convenience.hpp>
#include <boost\algorithm\string.hpp>
#define BOOST_GIL_IO_ADD_FS_PATH_SUPPORT #include <boost/gil/extension/io_new/png_all.hpp>
using namespace boost; using namespace gil;
int main() { rgba8_image_t img;
read_image( "C:\\gil_contribution\\test_images\\png\\wikipedia\\test.png", img, png_tag() );
write_view( "c:\\out.png", view( img ), png_tag() );
return 0; }
Very sorry for late reply, been too busy to do additional testing.
Your code works for for me also, but worst part is, I was not able to provide minimal test code that demonstrates what I experience in the main project as it works fine also. I will still try to do that and hopefully got some more info when it is done.
Thanks for your support and especially on work with GIL.
Cherrs, Szymon
Hi again, took a while but finally got some time to do some additional testing. I wrote small app: #include <fstream> #include <boost/foreach.hpp> #include <boost/gil/extension/io_new/png_read.hpp> using namespace boost; int main() { gil::rgba8_image_t img; gil::read_image("test.png", img, gil::png_tag()); std::ofstream os("dump.txt"); int size = sizeof(gil::rgba8_pixel_t); BOOST_FOREACH(const gil::rgba8_pixel_t& pix, std::make_pair(img._view.begin(), img._view.end())) { os << (int) pix[0] << " " << (int) pix[1] << " " << (int) pix[2] << " " << (int) pix[3] << "\n"; } } that code produces different text files when built in debug and release modes and observed text file difference is exactly what I also experience on the screen. For example: debug: 23 74 23 9 0 0 0 0 24 83 24 25 0 0 0 0 24 82 24 43 24 83 24 36 24 83 24 47 24 81 24 52 24 82 24 45 23 81 23 45 23 80 23 41 0 0 0 0 23 79 23 32 release: 255 255 255 9 0 0 0 0 255 255 255 25 0 0 0 0 255 255 255 43 255 255 255 36 255 255 255 47 255 255 255 52 255 255 255 45 255 255 255 45 255 255 255 41 0 0 0 0 255 255 255 32 Alpha channels is preserved but R G B channels are saturated to 255 always. Cheers, Simon