jpeg from memory to ofImage / ofTexture

hi!

i have a

  
const char * pic;  

with a jpeg in it.

I want to use this direct in oF, so I don’t have to go the way over filesystem.

Has somebody a good idea, how I can get this in an ofImage or ofTexture?
The setFromPixel / loadData methods don’t work, because they need raw pixel data.

I think of using FreeImage library because its already in oF and extend ofImage / ofTexture with a method for this. Is this a good idea?
Is this possible with FreeImage?

I also think about using libjpeg for this.

what do you think?

thanks

ben

got a solution for this with FreeImage:

in your .h

  
  
#include "FreeImage.h"  
  
FIMEMORY *hmem;  
FREE_IMAGE_FORMAT fif;  
FIBITMAP *bmp;  
  

in your .cpp

  
  
hmem = FreeImage_OpenMemory(pointer_to_jpeg,size_of_jpeg);  
fif = FreeImage_GetFileTypeFromMemory(hmem, 0);  
bmp = FreeImage_LoadFromMemory(fif, hmem, 0);