Rahul Singi

Rahul Singi

  • NA
  • 5
  • 0

A generic error occurred in GDI+ when savin image

Jan 25 2010 8:56 AM
Hi to all

when i am converting image to byte array then i got the error : "A generic error occurred in GDI+."

My code is as follows :

  using (MemoryStream stream = new MemoryStream())
  {
  sPath.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);
  data = stream.ToArray();
  }
  return data;

and i am also trying this code :

  ImageConverter converter = new ImageConverter();
  return (byte[])converter.ConvertTo(sPath, typeof(byte[]));

but i got the same error.

Answers (3)