View Single Post
  #1 (permalink)  
Old 04-13-2007, 06:15 AM
Karpagarajan Karpagarajan is offline
D-Web Analyst
 
Join Date: Mar 2007
Posts: 299
Karpagarajan is on a distinguished road
Thumbs up .NET tricks & Tips

Hi Here I am going to post the .NET tricks. Very useful one. You can also post your .NET tips here.

How to convert a Bitmap to a Byte Array

Here is some simple code that takes a bitmap and converts it to a byte array.

Dim myVar As MemoryStream = New MemoryStream Dim bitmapBytes As Byte()
'Create bitmap Dim bitmap As Bitmap = New Bitmap(50, 50)
bitmap.Save(myVar, System.Drawing.Imaging.ImageFormat.Jpeg)
bitmapBytes = myVar.ToArray
myVar.Close()
bitmap.Dispose()


thanks
__________________
Karpagarajan. R
Necessity is the mother of invention
Reply With Quote
Sponsored Links