Search code examples
imageboostloadistreamboost-gil

Boost.GIL Load Image from istream



I'm trying to load an image onto a Boost.GIL image from an std::istream. I've searched online but have yet to find a good solution.
Any help would be greatly appreciated.
Thanks alot


Solution

  • Take a look at the new version of gil io from here: http://code.google.com/p/gil-contributions/source/browse/trunk/gil_2.zip This is not officially part of boost yet, but it works well and is stable, and it supports what you need. You don't say what format you are trying to read, but to read jpeg you would have code like this:

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

    Reading png, bmp, raw, targa and tiff is also supported.