December 15, 2007
@ 04:15 PM

If you need to convert a Bitmap to an Byte array, here is how you do it.

  Public Shared Function ConvertToByteArray(ByVal value As Bitmap) As Byte()

      Dim bitmapBytes As Byte()

 

      Using stream As New System.IO.MemoryStream

 

        value.Save(stream, value.RawFormat)

        bitmapBytes = stream.ToArray

 

      End Using

 

      Return bitmapBytes

 

  End Function

Tip By: David McCarter

This code and more like it can be found in the dotNetTips.Utility assembly on the CodePlex site: http://www.codeplex.com/dotNetTipsUtility


 
Comments are closed.