MemoryStream stream = new MemoryStream();
// coverImagePictureBox.Image.Save(coverImagePictureBox.ImageLocation, System.Drawing.Imaging.ImageFormat.Jpeg);
coverImagePictureBox.Image.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);
byte[] pic = stream.ToArray();
I am loading an image in a form but when I'm calling imagebox.image
it's returning null although the image is loaded in the form correctly
and this is how i'm loading the image
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = "JPG Files(*.jpg|*.jpg|*.PNG Files(*.png|*.png|All Files(*.*)|*.*";
if (dlg.ShowDialog() == DialogResult.OK)
{
string picpath = dlg.FileName.ToString();
textBox1.Text = picpath;
coverImagePictureBox.ImageLocation = picpath;