Iam trying to extract image tags from the description section of an image using VB.NET. The image tags are stored in the description section as shown below:
sample Image
Tags I saved:
StyleShootsModel=sam001;StyleShootsAspectRatio=2_3;StyleShootsPreset=Jacqueline;StyleShootsProducts=21FKA00012;StyleShootsFraming=CRP;StyleShootsEquipment=StyleShoots Live ();
I’ve attempted the following sample code:
Public Shared Function GetDMetaTagFromImage(ByVal path As String) As DateTime
Using fs As FileStream = New FileStream(path, FileMode.Open, FileAccess.Read)
Using myImage As Image = Image.FromStream(fs, False, False)
Dim tagsValue As String = ""
Dim tags = myImage.PropertyItems.FirstOrDefault(Function(pi) pi.Id = &H9C9E)
If tags IsNot Nothing Then
tagsValue = Encoding.Unicode.GetString(tags.Value)
End If
Return tagsValue
End Using
End Using
End Function
However, the code doesn’t seem to work as expected. Can someone please provide guidance on how to correctly extract the image tags from the description section using VB.NET? Any help or suggestions would be greatly appreciated. Thanks in advance!