Serialize a an image with Boost & GIL
Hi, I'm currently using boost serialization in order to save/load my data structure. The problem is that it contains some images and even with the ZIP compression the files are really big (4x bigger than the jpeg). So, I'm looking for a way to compress a RGB/A image (HDR or not) (without file operation) in memory. If possible without using any image compression library, we already use OpenImageIO but it is not possible for now ! Any idea ? I have found the GIL library, but can't find how to: 1) convert raw to GIL image 2) serialize the GIL image 1) deserialize the GIL image 2) convert the GIL to raw image Of course, the goal is to have a good compression without writing temporary file ! Thanks --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
Hi, see below:
I have found the GIL library, but can't find how to:
1) convert raw to GIL image
There is a gil extension for the RAW image format in the develop branch of boost::gil. Look here: https://github.com/boostorg/gil/tree/develop/include/boost/gil/extension/io It uses libraw as the encoder.
2) serialize the GIL image
That we don't have but if you're are working on RGBA 8 bit data then most likely you can convert the gil type into an array of unsigned ints.
1) deserialize the GIL image 2) convert the GIL to raw image
Writing an raw image is not possible with the current extension. Regards, Christian
Le 12/04/2016 23:05, Christian Henning a écrit :
Hi,
see below:
I have found the GIL library, but can't find how to:
1) convert raw to GIL image
There is a gil extension for the RAW image format in the develop branch of boost::gil. Look here:
https://github.com/boostorg/gil/tree/develop/include/boost/gil/extension/io
It uses libraw as the encoder.
2) serialize the GIL image
That we don't have but if you're are working on RGBA 8 bit data then most likely you can convert the gil type into an array of unsigned ints.
1) deserialize the GIL image 2) convert the GIL to raw image
Writing an raw image is not possible with the current extension.
Regards, Christian
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thanks, But when I talk about "raw" I mean a simple RGBA, RGBA,RGBA.... format, not the camera format. I just have a memory block that contains simple RGBA set of pixels and need to compress/uncompress them. To summarie I need to : 1) compress the "unsigned int" (RGBA) into a compressed version in memory (without file access) 2) decompress to the same "unsigned int" (RGBA) memory block How can I do that ? if possible ! Thanks for your help --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
But when I talk about "raw" I mean a simple RGBA, RGBA,RGBA.... format, not the camera format.
I just have a memory block that contains simple RGBA set of pixels and need to compress/uncompress them.
To summarie I need to :
1) compress the "unsigned int" (RGBA) into a compressed version in memory (without file access) 2) decompress to the same "unsigned int" (RGBA) memory block
How can I do that ? if possible !
Sorry that is not possible with boost::gil. I suggest you use one of the many image libs, libjpeg for lossy compression or libpng for non-lossy compression. Christian
participants (2)
-
Christian Henning
-
Visual Designer - Digital Team