public static System.Drawing.Image ByteArrayToImage(byte[] b) { ImageConverter imgconv = new ImageConverter(); System.Drawing.Image img = (System.Drawing.Image)imgconv.ConvertFrom(b); return img; } public static byte[] ImageToByteArray(System.Drawing.Image img) { ImageConverter imgconv = new ImageConverter(); byte[] b = (byte[])imgconv.ConvertTo(img, typeof(byte[])); return b; }