I have found this code to get thumbnails from metadata. I want to use this on the compact framework 2 for windows mobile 5. However, I am not sure how to convert as Image.FromStream, Image.PropertIdList and PropertyItem are not memebers of System.Drawing.Image in the CF.

Anyone know how I could achieve the same result for the CF?
Thanks

VB Code:
  1. Private Const THUMBNAIL_DATA As Integer = 20507
  2.  
  3.     Private Function GetThumbnail(ByVal path As String) As Image
  4.         Dim stream1 As FileStream = File.OpenRead(path)
  5.         Dim image1 As Image = Image.FromStream(stream1, False, False)
  6.         Dim flag1 As Boolean = False
  7.         Dim num1 As Integer
  8.         For num1 = 0 To image1.PropertyIdList.Length - 1
  9.             If (image1.PropertyIdList(num1) = Me.THUMBNAIL_DATA) Then
  10.                 flag1 = True
  11.                 Exit For
  12.             End If
  13.         Next num1
  14.         If Not flag1 Then
  15.             Return Nothing
  16.         End If
  17.         Dim item1 As PropertyItem = image1.GetPropertyItem(Me.THUMBNAIL_DATA)
  18.         stream1.Close()
  19.         image1.Dispose()
  20.         Dim buffer1 As Byte() = item1.Value
  21.         Dim stream2 As New MemoryStream(buffer1.Length)
  22.         stream2.Write(buffer1, 0, buffer1.Length)
  23.         Return Image.FromStream(stream2)
  24.     End Function