hi
i store an image in sql server file(sdf file) by changing it to an array of bytes,
then when i want to retrive the image and show it in the picture box, i use this method:
public static Image CreateImage(byte[] imageData)
{
Image image=null;
if(imageData !=null)
{
using (MemoryStream inStream = new MemoryStream())
{
inStream.Write(imageData, 0, imageData.Length);
image = Bitmap.FromStream(inStream);
}
}
return image;
}
but when i want to save the image retrived from database on the disk with this code:
if (pictueBox1.Image != null)
{
pictueBox1.Image.Save(@"pic3.jpg", ImageFormat.Jpeg);
}
it gives an error :
An unhandled exception of type 'System.Runtime.InteropServices.ExternalException' occurred in System.Drawing.dll
Additional information: A generic error occurred in GDI+.
also this error doesn't happen when i load image from disk instead of database