libpng is rather obtuse to use, but libspng has a much simpler API and could be a good way to implement PNG support.
It would be useful if DIPlib could read from and write to memory buffers instead of a file for JPEG and PNG. For other file formats this might make less sense, but these two formats are quite popular for storage in a database or embedding in a data stream. All of libpng, libspng and libjpeg support memory buffers. We currently have a function dip::ImageReadJPEG(String const&) and a function dip::ImageWriteJPEG(Image const&, String const&, ...). We can easily add an overload where the String const& (file name) is replaced by a char* or void* (buffer pointer). Hopefully most of the internal code can be reused.
libpng is rather obtuse to use, but libspng has a much simpler API and could be a good way to implement PNG support.
It would be useful if DIPlib could read from and write to memory buffers instead of a file for JPEG and PNG. For other file formats this might make less sense, but these two formats are quite popular for storage in a database or embedding in a data stream. All of libpng, libspng and libjpeg support memory buffers. We currently have a function
dip::ImageReadJPEG(String const&)
and a functiondip::ImageWriteJPEG(Image const&, String const&, ...)
. We can easily add an overload where theString const&
(file name) is replaced by achar*
orvoid*
(buffer pointer). Hopefully most of the internal code can be reused.