0% found this document useful (0 votes)
12 views

You Can Convert An Image Object

MemoryStream object can be used to convert an image object between Image and Byte Array. You can check if the image is accordant with E:VBproject1.jpg.

Uploaded by

Phearun Phen
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

You Can Convert An Image Object

MemoryStream object can be used to convert an image object between Image and Byte Array. You can check if the image is accordant with E:VBproject1.jpg.

Uploaded by

Phearun Phen
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

You can convert an image object between Image and Byte Array by means of MemoryStream object like this:

Code Block Imports System.IO Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim myImage As Image = Image.FromFile("E:\VBproject\1.jpg") 'Image to byte[] Dim imgMemoryStream As MemoryStream = New MemoryStream() Dim imgByteArray As Byte() = Nothing myImage.Save(imgMemoryStream, System.Drawing.Imaging.ImageFormat.Jpeg) imgByteArray = imgMemoryStream.GetBuffer() 'Byte[] to image imgMemoryStream = New IO.MemoryStream(imgByteArray) myImage = Drawing.Image.FromStream(imgMemoryStream) 'Show it and check if the image is accordant with E:\VBproject\1.jpg. 3LFWXUH%R[,PDJH P\,PDJH End Sub (QGClass Trackback: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2324862&SiteID=1

For Visual Basic 6 questions, please read... Visual Basic 6 and Earlier forum http://www.vbforums.com/forumdisplay.php?f=1

You might also like