i have db with images in the byte array format. I need to upload particular image from there and compressed by free image methods. But first of all need to convert my byte array to FIBITMAP format.My code:
string user = User.Identity.GetUserId();
ApplicationUser au = db.Users.Include(t => t.Pictures).FirstOrDefault(t => (t.Id) == user);
Picture pic = au.Pictures.Where(p => p.Id == id).First();
FIBITMAP dib = FreeImage.LoadFromStream(new MemoryStream(pic.Image));
Error is a :
An exception of type 'System.BadImageFormatException' occurred in FreeImageNET.dll but was not handled in user code Additional information: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
in the documents wrote
public static FIBITMAP LoadFromStream( Stream stream )
Parameters stream Type: System.IO.Stream The stream to read from. Return Value Handle to a FreeImage bitmap.
I cant understand where is my mistake, btw i tried to use load/loadBitmap etc. with different variatons of my array(i converted it to bitmap). Please help me.
User contributions licensed under CC BY-SA 3.0