3

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.

Cris Luengo
  • 55,762
  • 10
  • 62
  • 120
Aman
  • 696
  • 1
  • 8
  • 26

1 Answers1

1

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();
combinatorial
  • 9,132
  • 4
  • 40
  • 58