Reputation: 453
I am trying to convert a picturebox in byte array
MemoryStream s = new MemoryStream();
picProfilePicture.Image.Save(s, System.Drawing.Imaging.ImageFormat.Jpeg);
byte[] pic = s.ToArray();
But when i am using this method i am getting general error in GDI+. How can i fix that?
Upvotes: 0
Views: 48
Reputation: 623
FileStream fs = new FileStream(selectedFile, FileMode.Open, FileAccess.Read);
byte[] bimage = new byte[fs.Length];
fs.Read(bimage, 0, Convert.ToInt32(fs.Length));
Upvotes: 1