Hello, i'm trying to write to an images keywords/tags using ExifWorks. But it won't write, below is my code and i'm not sure what's wrong.
Public Class EXIFtest
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim text2 As String = TextBox2.Text
Dim text3 As String = Replace(text2, ".jpg", "")
Dim ef As New ExifWorks(text2)
Dim imgWithExif As Image = ef._Image
ef.Keyword = TextBox1.Text
imgWithExif.Save(text3 + "TAGGED.jpg")
End Sub
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
TextBox2.Text = ("C:\Users\Simon\Music\Pictures\Exif Tests\DSC_1847.jpg")
PictureBox2.ImageLocation = TextBox2.Text
End Sub
Private Sub EXIFtest_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
TextBox2.Text = PictureBox2.ImageLocation
End Sub
End Class
Is the main program
I've added to ExifWorks the below
Public Property Keyword() As String
Get
Return Me.GetPropertyString(TagNames.Keyword)
End Get
Set(ByVal Value As String)
Try
Me.SetPropertyString(TagNames.Keyword, Value)
Catch ex As Exception
End Try
End Set
End Property
SB.Append("\n\tKeyword: " & Me.Keyword)
and
Public Enum TagNames As Integer
ExifIFD = &H8769
GpsIFD = &H8825
NewSubfileType = &HFE
SubfileType = &HFF
ImageWidth = &H100
ImageHeight = &H101
BitsPerSample = &H102
Compression = &H103
PhotometricInterp = &H106
ThreshHolding = &H107
CellWidth = &H108
CellHeight = &H109
FillOrder = &H10A
Keyword = &H9C9E
I'm trying to add to the image property, tags. But it isn't working, any suggestions
Imports Microsoft.ImageMetadata
Imports Microsoft.PhotoToolboxFoundation
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim text2 As String = TextBox2.Text
Try
Dim img_path As String = "C:\Users\Simon\Music\Pictures\Exif Tests\DSC_1847.jpg"
Dim p As MetadataPolicy = (New MetadataPolicyManager()).loadPolicy("C:\Users\Simon\Documents\Visual Studio 2010\Projects\EXIFtest\EXIFtest\Microsoft.PhotoToolboxFoundation.ToolboxPolicy.xml")
Dim imgProxy As ImageFileProxy = New ImageFileProxy(img_path, p)
Dim desc As Object = imgProxy.Data(p.getTagIndex("Description"))
imgProxy.Data(p.getTagIndex("Description")) = "This is a test description for the jpg!"
TextBox1.Text = ("Description: " + desc.ToString())
imgProxy.commit()
Catch ex As Exception
MessageBox.Show(ex.Message, ErrorToString)
End Try
End Sub
What I have tried:
I've tried adding the hex and identifiers to the original class.