CSharp examples for System.Drawing:Image Convert
Convert Bitmap to byte array
using System.Drawing; public class Main{ /// <summary> /// Converte um Bitmap em byte array /// </summary> /// <param name="instance">Bitmap a ser convertido</param> /// <returns>byte array convertido</returns> public static byte[] ToByteArray(this Bitmap instance) {/*from w w w. ja va2 s . com*/ ImageConverter converter = new ImageConverter(); return (byte[])converter.ConvertTo(instance, typeof(byte[])); } }