Fastest way to convert Image to Byte array

There is a RawFormat property of Image parameter which returns the file format of the image.
You might try the following:

// extension method
public static byte[] imageToByteArray(this System.Drawing.Image image)
{
    using(var ms = new MemoryStream())
    {
        image.Save(ms, image.RawFormat);
        return ms.ToArray();
    }
}

Leave a Comment