
Hi there I have an uncompressed RGBA Tiff file (RGB + alpha channel) which I'm trying to split into two data files, one containing the RGB data, and the other containing the alpha (transparency) data. Here's a code snippet showing my (probably misguided) attempt at doing this: image_read_info< tiff_tag > info = read_image_info(in, tiff_tag()); if ( info._photometric_interpretation == 2 && info._samples_per_pixel == 4 ) { // RGBA rgba8_image_t rgba_img; // Read RGBA image ... read_image(in, rgba_img, tiff_tag()); // Set up planar image (to extract alpha channel) and rgb image // (to extract rgb data) rgba8_planar_image_t dst_planar_image(rgba_img.dimensions()); rgb8_image_t dst_rgb_image(rgba_img.dimensions() ); // Convert pixels to appropriate view copy_and_convert_pixels(view(rgba_img), view(dst_rgb_image)); copy_and_convert_pixels(view(rgba_img), view(dst_planar_image)); // Write out data ofstream out((ofilename+"rbg").c_str(), ios_base::binary), alphaout((ofilename +"alpha").c_str(), ios_base::binary); out.write(reinterpret_cast<const char*>(interleaved_view_get_raw_data(view(dst_rgb_image))), info._width * info._height * 3); alphaout.write(reinterpret_cast<const char*>(planar_view_get_raw_data(view(dst_planar_image), 3)), info._width * info._height); ... 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. 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. Thanks a million in advance! All the best, ... Corinna