I'm trying to convert a JPG image to a (double) 2d array. Using:
Image image = Image.FromFile("image.jpg");
I get a 500 x 500 image (according to image.Size.Height(Width)). But when I try to convert this to a byte array using
byte[] arr;
using (MemoryStream ms = new MemoryStream())
{
image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
arr = ms.ToArray();
}
I get arr.GetLength(0)=35640
, which is smaller than 500*500=250000. I'll convert the 1d array arr
to a 2d array after that. Am I missing something?