I need to use boost GIL library to load a '.bmp' image, copy it to buffer and send it through sockets.
I copied the image in rgb8_view_t and tried to get pixels out of it but found no function which can do so. Following is the code snippet I wrote:
rgb8_image_t img;
bmp_read_image("test.bmp", img);
rgb8_view_t myView(view(img));
Please suggest if there is some other way to get the buffer out of the image.
Something like this should do it...
gil::rgb8_image_t::const_view_t view = const_view(img);
assert(view.is_1d_traversable());
int width = view.width();
int height = view.height();
const char* buffer = view.begin().x();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With