If you use System.Drawing, you can try this code
Imports System.Drawing
Imports System.Drawing.Imaging
Public Shared Function GetBinary(ByVal image As Image, ByVal format As ImageFormat) As Byte()
Using ms As New System.IO.MemoryStream
If (format Is Nothing) Then
format = image.RawFormat
End If
image.Save(ms, format)
Return ms.ToArray()
End Using
End Function
Example:
Dim binaryArray As Byte()
binaryArray = GetBinary(PictureBox1.Image, Nothing)
binaryArray = GetBinary(Image.FromFile(sourceImageFileName), ImageFormat.Png)
System.IO.File.WriteAllBytes(destinationImageFileName, binaryArray)