Boost::GIL How to save image as JPEG or PNG into char*?

2.3k views Asked by At

So I see samples all around on saving into file. But I wonder if it is possible to save into char* or string instead of file - so to say keep it in memory?

2

There are 2 answers

2
clstrfsck On BEST ANSWER

There doesn't seem to be anything to facilitate this in boost itself. All I/O seems to be based on supplying filenames.

However, there seems to be an extension here called io_new that has streams based I/O.

See documentation here for an example (search for "Reading And Writing In-Memory Buffers").

0
albezanc On

Boost.GIL v1.75: reading this docs at the section "Reading And Writing In-Memory Buffers" seems boost::gil::write_view(...) can also write into a memory buffer. Please see also this question