2

I need to be able to load images (jpeg, png etc.) from the memory in Boost::Gil framework. Is there a way to do that?

Thanky for your answers!

Van Coding
  • 24,244
  • 24
  • 88
  • 132
  • Seems the status of this may have changed with an extension: http://stackoverflow.com/questions/8039199/boostgil-how-to-save-image-as-jpeg-or-png-into-char – Flexo Nov 28 '11 at 18:08
  • See also answer of the sister question http://stackoverflow.com/questions/8039199/boostgil-how-to-save-image-as-jpeg-or-png-into-char – rodrigob Dec 20 '11 at 22:36

2 Answers2

1

The according to the documentation the read/convert functions only accept filenames as input, not general streams or pointers, so this seems to not be possible.

Grep on the header files seems to agree too:

/usr/include/boost/gil > grep -nri stream *
/usr/include/boost/gil >

and searches for void * or char * don't return any relevant results either.

Flexo
  • 87,323
  • 22
  • 191
  • 272
  • I'd guess at least one of the backend libraries it (presumably) calls to do the IO is structured such that this a reasonable design decision. IIRC readpng_init() takes a FILE*, which you could do with fmemopen() but it is annoying to expose FILE* to modern C++ code. – Flexo Jan 27 '11 at 15:56
  • You can always mkfifo()+fork() to work around limitations like this in 3rd party code if it really is critical. – Flexo Jan 27 '11 at 16:01