Josh Josh - 4 months ago 63
C++ Question

Gdiplus::Image from byte array

I'm executing dcraw and using an anonymous pipe to pipe it to a char array.

My question is how can I create a

object from a char array containing the jpeg image? Without writing and reading it from the disk.


You can create a Gdiplus::Bitmap from an IStream source. There are built-in Windows APIs that can do this for you - see CreateStreamOnHGlobal. Another way is to write your own class that implements IStream.

Here is an example using CreateStreamOnHGlobal to load PNG resources from memory.