VB.NET. #, .
Public Function ConvertImageType(Image As Bitmap, Format As
Drawing.Imaging.ImageFormat) As Byte()
'Declare a new memory stream to write to
Dim SaveStream As New IO.MemoryStream
'Save the bitmap/image to the memory stream in the desired format
Image.Save(SaveStream, Format)
'Extract the file bytes from the memory stream
Dim ConvertedImageBytes() As Byte = SaveStream.ToArray
'Return bytes to caller
Return ConvertedImageBytes
End Function
/ : Jpeg, Png, Bmp, Ico, Gif, Emf, Exif, Tiff Wmf.