1. #1 by hasan habib on July 8, 2012 - 3:32 pm

    nice code!!!
    readEXIFMetadata working fine.
    but SaveEXIFMetadata not working.
    i am using vb.net 2008
    need to update tag/keyword of a image.
    but SaveEXIFMetadata not work.
    Dim newImage As Image = Image.FromFile(ImageFileName)
    Dim Md As New ImageMetadata
    Dim MDS As New clsReadMetaData
    Md.Keywords = txtMetaData.Text.Trim
    MDS.SaveEXIFMetadata(newImage, Md, “c:\dd.jpg”)

    please help

    • #2 by CharlyMairo on June 10, 2013 - 8:12 am

      Hello Hasan
      I still have this problem of writing data as well. When i want to update the field for “keywords”, the previsous existkng keywords remains
      Did you find any solution to clear existing keywords before writing new?

      Thank you for your help

      ps: i’m trying to build up a explorer library where users will apply keywords from specific list. Therefore, i need to ensure to remove existing ones (if any) before to enter new keywords

      • #3 by Hasan Habib on August 27, 2013 - 3:28 pm


        Dim imgFile As FileStream = New FileStream(LblFileLocation, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
        Dim fileBytes(imgFile.Length) As Byte
        imgFile.Read(fileBytes, 0, fileBytes.Length)
        Dim MS As MemoryStream = New MemoryStream(fileBytes)
        Dim TheImage As Image = Image.FromStream(MS)
        Dim AllProperties() As PropertyItem = TheImage.PropertyItems
        Dim PropItem As PropertyItem = AllProperties(0)
        Dim strNewValue() As Byte = System.Text.ASCIIEncoding.Unicode.GetBytes(txtBox.Text.Trim)
        PropItem.Id = 40094
        PropItem.Len = strNewValue.Length
        PropItem.Value = strNewValue
        PropItem.Type = 1

        MsgBox(“Save successful”, MsgBoxStyle.Information, “Photo Metadata”)

        Catch ex As Exception
        MsgBox(Err.Description, MsgBoxStyle.Information, “Photo Metadata”)

        End Try

  2. #4 by E on August 15, 2012 - 11:10 am

    Its working for me.
    Remove MDS.ReadEXIFMetadata(ImageFileName)
    and try.

  3. #5 by CharlyMairo on June 10, 2013 - 8:08 am

    Actually Hasan is right
    Any Keywords (id 40094) already in the image file will remains
    Thre is no way to completly remove the existing keyword information.
    I’m fighting with this subject since 1 week now.

    Any news on this?

  4. #6 by sean on August 26, 2013 - 11:00 am

    thank you soooooo much been searching for a way to do this for days

  5. #7 by billweaver20 on December 6, 2013 - 7:14 am

    I too have had it put to me to come up with a way to catalog a massive collection of pictures in a way specific to the customer and, though I am only now digging into it, I expect your code will put me miles down the road toward getting the job done. Thanks so much.

  1. Get or Write Image Metadata with C# | Kelly's Chronicles

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: