Search code examples
c++boostjpegboost-gil

Read a JPEG image from memory with boost::gil


I am trying to read an image from memory by using boost::gil present in boost 1.53. I have taken the following lines from an example taken from internet:

#include <boost/gil/gil_all.hpp>
boost::gil::rgb8_image_t img;
boost::gil::image_read_settings<jpeg_tag> readSettings;
boost::gil::read_image(mystream, img, readSettings);

Except the first line, the type and function in the remaining lines cannot be found in the boost::gil namespace, so I cannot test if the above lines do what I want. Do you have any idea where to get the required types and functions?


Solution

  • See the new version of gil here: gil stable version

    It works well and it is stable.

    using namespace boost::gil;
    image_read_settings<jpeg_tag> readSettings;
    rgb8_image_t newImage;
    read_image(stream, newImage, readSettings);
    

    You code seems correct.