[boost-users][GIL] Colors broken after moving to New IO
Hi, Since New IO is now accepted to BOOST I could replace old one with new version (review one). Problem is, the moment I replaced header file and png_load_file() to load_image() all images have invalid colors. Am I doing to little by just replacing those 2? Regadrds, Szymon
Hi Szymon, the new IO extension isn't yet part of boost. Are you
referring to my repository at good code?
Also there is no png_load_file() in the old version nor is there a
load_image() in the new IO. The test code reads and writes png's in
various formats. What is your format? A little code would be nice,
too. ;-)
Regards,
Christian
On Sun, Mar 6, 2011 at 7:16 AM, Szymon Gatner
Hi,
Since New IO is now accepted to BOOST I could replace old one with new version (review one). Problem is, the moment I replaced header file and png_load_file() to load_image() all images have invalid colors. Am I doing to little by just replacing those 2?
Regadrds, Szymon _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
2011/3/6 Christian Henning
Hi Szymon, the new IO extension isn't yet part of boost. Are you referring to my repository at good code?
Also there is no png_load_file() in the old version nor is there a load_image() in the new IO. The test code reads and writes png's in various formats. What is your format? A little code would be nice, too. ;-)
Sorry for not checking for valid function names. I used this code:
http://gil-contributions.googlecode.com/files/boost_review.zip. A
little portion of my code then ;)
using namespace boost::gil;
typedef boost::mpl::vector
Hi,
this is a snippet from implementation of 2D OpenGL texture. setData() is overloaded for various image formats so that valid constant is passed to GL Api (rgb8_image_t image overload passes GL_RGB8 etc). I didn't do anything but changing png_read_image() to read_image() and after running app all images on screen were broken - most of images is white.
could you try to load images without using any_image<...>. Also can you try to load one of the png files from the test_images folder? What system to you work on? What's the compiler?
On a side note: maybe new io could use boost::exception? Would be great if read_image() used boost::errinfo_file_name() when file cannot be opened as now it is not better than just returning error code.
It's a good idea. I'll put it on my todo list. For backward compatibility I might have a compiler symbol though the user can still have std::ios_base::failure.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
2011/3/7 Christian Henning
could you try to load images without using any_image<...>. Also can you try to load one of the png files from the test_images folder?
What system to you work on? What's the compiler?
New info: - using Visual Studio 2008 SP1 - it only happens in Release mode (often suggests uninitialized variables) - attaching screen shoot of application displaying test.png from test_images (in Debug mode all is fine) Cheers, Szymon
2011/3/7 Christian Henning
: could you try to load images without using any_image<...>. Also can you try to load one of the png files from the test_images folder?
What system to you work on? What's the compiler?
New info:
- using Visual Studio 2008 SP1
You might try building release with optimization turned off. I've had problems with optimization by Microsoft compilers in the past; it's not common, but it's easy to rule out. If that does turn out to be the issue, and you can isolate the location, you can turn off optimization for individual compilation units or even for specific regions of code (assuming those pragmas still exist - it's been five or six years since I've had to use them). John
- it only happens in Release mode (often suggests uninitialized variables) - attaching screen shoot of application displaying test.png from test_images (in Debug mode all is fine)
Cheers, Szymon This e-mail message and any attachment(s) transmitted with it are intended only for the use of the recipient(s) named above.This message may be privileged and/or confidential. If you are not an intended recipient, you may not review, copy or distribute this message. If you have received this communication in error, please notify us immediately by e-mail and delete the original message.
Hi Szymon, sorry to see you keep having issues with gil::io.
New info:
- using Visual Studio 2008 SP1 - it only happens in Release mode (often suggests uninitialized variables) - attaching screen shoot of application displaying test.png from test_images (in Debug mode all is fine)
I did try a couple of things but couldn't reproduce your issue. I made
sure to use the boost_review code version. I tried debug/release
version with VS2010 and VS2008 for 64bit. What's your version of your
lib png?
Here is the code I tried:
#include
2011/3/8 Christian Henning
Here is the code I tried:
#include
#define BOOST_FILESYSTEM_VERSION 2 #include
#include
#define BOOST_GIL_IO_ADD_FS_PATH_SUPPORT #include
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
2011/3/14 Szymon Gatner
2011/3/8 Christian Henning
: Here is the code I tried:
#include
#define BOOST_FILESYSTEM_VERSION 2 #include
#include
#define BOOST_GIL_IO_ADD_FS_PATH_SUPPORT #include
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
Hi Szymon,
#include <fstream> #include
#include 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:
I have tried your code and cannot recreate your problem. Both dump.txt files have exactly the same data inside. What compiler do you use and what architecture do you work on? Regards, Christian
Hey Christian,
2011/4/27 Christian Henning
Hi Szymon,
#include <fstream> #include
#include 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:
I have tried your code and cannot recreate your problem. Both dump.txt files have exactly the same data inside. What compiler do you use and what architecture do you work on?
Visual C++ 2008 SP1, Win7 x64 building app as 32 bit. Using libpng 1.2.44 as I was not able to build with 1.5 branch.
Hi Szymon, I could recreate your problem with Visual Studio 2010 in
32bit. The problem does not occur with 64bit. I'll have a look later
what the problem is.
Thanks for reporting,
Christian
On Wed, Apr 27, 2011 at 10:37 AM, Szymon Gatner
Hey Christian,
2011/4/27 Christian Henning
: Hi Szymon,
#include <fstream> #include
#include 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:
I have tried your code and cannot recreate your problem. Both dump.txt files have exactly the same data inside. What compiler do you use and what architecture do you work on?
Visual C++ 2008 SP1, Win7 x64 building app as 32 bit.
Using libpng 1.2.44 as I was not able to build with 1.5 branch. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hi Szymon,
patients pays off some times. ;-) I could locate the problem and it
turns out it was a simple issue of missing to initialize member
variables.
Please get the latest and try again. I also added support for new libpng 1.5.
Thanks for your patience and using the new gil:io.
Christian
On Wed, Apr 27, 2011 at 3:24 PM, Christian Henning
Hi Szymon, I could recreate your problem with Visual Studio 2010 in 32bit. The problem does not occur with 64bit. I'll have a look later what the problem is.
Thanks for reporting, Christian
On Wed, Apr 27, 2011 at 10:37 AM, Szymon Gatner
wrote: Hey Christian,
2011/4/27 Christian Henning
: Hi Szymon,
#include <fstream> #include
#include 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:
I have tried your code and cannot recreate your problem. Both dump.txt files have exactly the same data inside. What compiler do you use and what architecture do you work on?
Visual C++ 2008 SP1, Win7 x64 building app as 32 bit.
Using libpng 1.2.44 as I was not able to build with 1.5 branch. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
2011/5/15 Christian Henning
Hi Szymon,
patients pays off some times. ;-) I could locate the problem and it turns out it was a simple issue of missing to initialize member variables.
Please get the latest and try again. I also added support for new libpng 1.5.
Thanks for your patience and using the new gil:io.
Christian
Got the latest, all is perfect now. Had to do small change to png write also to be able to build with libpng 1.5. Thanks to you for this nifty chunk of code. No more crappy 3rd party libs to do image loading. Cheers, Simon
participants (3)
-
Christian Henning
-
John Wilkinson
-
Szymon Gatner