VB.NET编程语言在图像的处理方面是比较实用的。我们可以通过本文介绍的关于VB.NET二进制图像获取的方式对这一知识点进行详细的解读。首先让我们一起来看看具体的代码编写方式。#t#
从 Byte() 中进行VB.NET二进制图像的获取
- Public Function GetImage
FromStream
()Function GetImageFromStream
(ByVal ImageStream As Byte())
As Image - Me.mobjImage = Nothing
- If (ImageStream Is Nothing)
Then - Return False
- End If
- Dim index As Integer = 0
- If (((ImageStream(0) = &H15)
AndAlso (ImageStream(1) = &H1C))
AndAlso (ImageStream.Length
>= 80)) Then- index = &H4E
- Do While (index < (ImageStream.
Length - 1))- If ((ImageStream(index) = &H42)
AndAlso (ImageStream((index +
1)) = &H4D)) Then- Exit Do
- End If
- index += 1
- Loop
- If ((ImageStream(index) <> &H42)
OrElse (ImageStream((index
+ 1)) <> &H4D)) Then- index = &H87
- End If
- End If
- Try
- Dim stream As New MemoryStream
(ImageStream, index,
(ImageStream.Length - index))- objImage = Drawing.Image.
FromStream(stream)- Catch obj1 As Exception
- return nothing
- End Try
- Return objImage
- End Function
VB.NET二进制图像的相关读取方式就为大家介绍到这里。