Hello! I want to know how to retrieve image caption using .NET. I have collected some information about IPTC and exif tags. I have a function where it retrieves image caption stored in tag 10e. However, this code does not work for many of the images. Please help.
Public Function displaydetails( ByVal img1 As String)
Dim s As String
Dim i As Integer
Dim j As Integer
Dim encoding As System.Text.Enc oding = System.Text.Enc oding.UTF8
Dim aprop As PropertyItem
Dim img As Image
img = New Bitmap("c:\blan k1.jpg")
s = " "
Try
img = New Bitmap(img1)
''''''start actual process here''''''''
i = 0
j = 0
s = ""
For Each aprop In img.PropertyIte ms
If aprop.Id.ToStri ng("x") = "10e" Then
s = Trim(encoding.G etString(aprop. Value))
Exit For
End If
Next
If s = "" Then
s = " "
End If
Catch
End Try
Return s
''''''end actual process here''''''''''
End Function
Public Function displaydetails( ByVal img1 As String)
Dim s As String
Dim i As Integer
Dim j As Integer
Dim encoding As System.Text.Enc oding = System.Text.Enc oding.UTF8
Dim aprop As PropertyItem
Dim img As Image
img = New Bitmap("c:\blan k1.jpg")
s = " "
Try
img = New Bitmap(img1)
''''''start actual process here''''''''
i = 0
j = 0
s = ""
For Each aprop In img.PropertyIte ms
If aprop.Id.ToStri ng("x") = "10e" Then
s = Trim(encoding.G etString(aprop. Value))
Exit For
End If
Next
If s = "" Then
s = " "
End If
Catch
End Try
Return s
''''''end actual process here''''''''''
End Function
Comment