VB.NET二進制圖像獲取方式介紹
作者:佚名
如果我們要想讀取一個程序中的資料圖像時應當采用何種方法才能達到預期的目標呢?我們可以通過使用VB.NET來是實現。下面就是VB.NET二進制圖形的相關讀取方法。
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二進制圖像的相關讀取方式就為大家介紹到這里。
責任編輯:曹凱
來源:
博客園