[C#] Error enregistrer un bitmap dans un memorystream
Bonjour, je souhaite convertir un bitmpa en binaire et pour cela je passe par un memory stream. Malheureusement, je n'arrive pas a enregistrer mon Bitmap dans le stream :
Code:
1 2 3 4 5
| MemoryStream ms = new MemoryStream();
bPOIPicture.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);//Porb ici
//Create a byte [] from the picture
byte[]myByteArray = ms.ToArray(); |
Je recois une {"NotSupportedException"} et la stack trace:
"at Microsoft.AGL.Common.MISC.HandleAr()\r\nat System.Drawing.Image.Save()\r\nat DeviceApplication4.Form1.loadImage()\r\nat DeviceApplication4.Form1..ctor()\r\nat DeviceApplication4.Program.Main()\r\n"