R
RichardF
Can anyone tell me what is wrong with this code?
I want to get the ocntents of the JPEG image into a byte array. After
the theStream.read call, the theBytes array is still filled with all
nulls. and iCount is zero.
I used this article
(http://msdn.microsoft.com/library/d.../html/frlrfsystemiomemorystreamclasstopic.asp)
as a starting point.
Thanks for any help
RichardF
Imports System
Imports System.IO
Imports System.Text
Imports System.Drawing
Module Module1
Sub Main()
Dim theImage As Image
Dim theStream As New MemoryStream
Dim theBytes As Byte()
Dim iCount As Integer
Try
theImage = Image.FromFile("C:\Images\Test.jpg")
theImage.Save(theStream, Imaging.ImageFormat.Jpeg)
theBytes = New Byte(theStream.Length - 1) {}
iCount = theStream.Read(theBytes, 0, theStream.Length - 1)
Catch ex As Exception
End Try
End Sub
End Module
I want to get the ocntents of the JPEG image into a byte array. After
the theStream.read call, the theBytes array is still filled with all
nulls. and iCount is zero.
I used this article
(http://msdn.microsoft.com/library/d.../html/frlrfsystemiomemorystreamclasstopic.asp)
as a starting point.
Thanks for any help
RichardF
Imports System
Imports System.IO
Imports System.Text
Imports System.Drawing
Module Module1
Sub Main()
Dim theImage As Image
Dim theStream As New MemoryStream
Dim theBytes As Byte()
Dim iCount As Integer
Try
theImage = Image.FromFile("C:\Images\Test.jpg")
theImage.Save(theStream, Imaging.ImageFormat.Jpeg)
theBytes = New Byte(theStream.Length - 1) {}
iCount = theStream.Read(theBytes, 0, theStream.Length - 1)
Catch ex As Exception
End Try
End Sub
End Module