
Hi Phil,
void read_jpeg_image_from_mem(const char* begin, const char* end, gil::image dest) { ..... jpeg_mem_src(...., begin, end-begin); ..... }
So there is basically no overhead. Wrapping a block of memory up in a stream, and then unwrapping it again to pass it to the image library's C API, and pulling in another Boost library like Boost.IOStreams to do so, looks like overkill.
As far as I understand jpeg_mem_src code only initializes the jpeg_source_mgr with the in-memory data source callbacks. These callbacks are used during the reading process to fill up buffers and to skip data. io_new is having its own set of these callbacks, which admittedly are a very close resemblance to libjpeg's ones. Though, jpeg_mem_src doesn't read anything. And yes, you're right it looks a bit like overkill. But it's not a huge one, I believe. Regards, Christian