here is my program that i have written
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Drawing;
using System.Drawing.Imaging;
using System.Data;
namespace ConsoleApplication7
{
class Program
{
static void Main(string[] args)
{
Image img = Image.FromFile("C:\\images.JPG");
byte[] bArr = imgToByteArray(img);
}
public byte[] imgToByteArray(System.Drawing.Image Imagein)
{
byte[] data = null;using (System.IO.MemoryStream ms = new MemoryStream())
{
Imagein.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
data = ms.ToArray();
}
return data;
}
}
}
now when i build the program it shows error
an object reference is required for the non static field, method or property 'Program.imgToByteArray(Image)'