
Hi Corinna,
The alpha transparency data is ok as far as I can see, but the RGB data is mangled ... presumably I've misunderstood how the copy_and_convert_pixels() works.
The default converter for converting a rgba value into anything will multiply the alpha value to all other channels. That's why the rgb data looks incorrect. I suggest you have your own color converter. Here is some code: #include <boost/gil/gil_all.hpp> using namespace boost; using namespace gil; class convert_rgba_to_rgb { public: void operator() ( const rgba8_pixel_t& src , rgb8_pixel_t& dst ) const { get_color(dst,red_t()) = get_color(src,red_t()); get_color(dst,green_t()) = get_color(src,green_t()); get_color(dst,blue_t()) = get_color(src,blue_t()); } }; int main() { rgba8_image_t img( 640, 480 ); fill_pixels( view( img ), rgba8_pixel_t( 255, 128, 10, 99 )); rgba8_planar_image_t dst_planar_image(img.dimensions()); rgb8_image_t dst_rgb_image(img.dimensions() ); copy_and_convert_pixels( view( img ), view( dst_rgb_image ), convert_rgba_to_rgb() ); rgba8_pixel_t v = *view( img ).xy_at( 0, 0 ); rgb8_pixel_t p = *view( dst_rgb_image ).xy_at( 0, 0 ); return 0; }
I'm new to the boost::gil library, and am finding the documentation a little hard to get to grips with, so any hints you could give would be greatly appreciated.
Let me know if you have some more issues. Regards, Christian