Sign in to follow this  
Oni Sephiroth

FreeImage - bitmap from memory C++

Recommended Posts

Basically, in a nutshell, I have an archive of resources (not a standard archive, one I wrote myself). Let's say for example I pull a .png file out of that archive and into a char array. So, the ENTIRE image file is in that array, including the header. I need to get the image data into a dib. I looked around and found this function:

[source]FreeImage_LoadFromHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0));[/source]

Could I use this to get what I need? For example...

Assume that fif, io and image are declared and initialized. image is the char array of image data.
FIBITMAP* dib = FreeImage_LoadFromHandle(fif, &io, (fi_handle)image, 0);
unsigned char * bits = FreeImage_GetBits(dib);

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this