Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. TagLibSharp help needed

TagLibSharp help needed

Scheduled Pinned Locked Moved C#
helpquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    joost versteegen
    wrote on last edited by
    #1

    When I try to write to a comment tag field and save the file, I get either expected result, wrong result or an error. Does anyone have suggestions or tips? The intent is to add text to the metadata of jpg images so that I can search images later. Here's the code sofar:

    private void buttonOpenFile\_Click(object sender, EventArgs e)
    {
      using(OpenFileDialog d = new OpenFileDialog())
      {
        d.InitialDirectory = @"D:\\";
        d.Filter = "All jpeg files|\*.jpg;\*.jpeg";
        d.ShowDialog();
        \_File = TagLib.File.Create(d.FileName,"image/jpeg", TagLib.ReadStyle.None);
      }
      textBox1.Text = \_File.Tag.Comment;
    }
    private void buttonSaveFile\_Click(object sender, EventArgs e)
    {
      \_File.Tag.Comment = textBox1.Text;
      \_File.Save();
    }
    
    L 2 Replies Last reply
    0
    • J joost versteegen

      When I try to write to a comment tag field and save the file, I get either expected result, wrong result or an error. Does anyone have suggestions or tips? The intent is to add text to the metadata of jpg images so that I can search images later. Here's the code sofar:

      private void buttonOpenFile\_Click(object sender, EventArgs e)
      {
        using(OpenFileDialog d = new OpenFileDialog())
        {
          d.InitialDirectory = @"D:\\";
          d.Filter = "All jpeg files|\*.jpg;\*.jpeg";
          d.ShowDialog();
          \_File = TagLib.File.Create(d.FileName,"image/jpeg", TagLib.ReadStyle.None);
        }
        textBox1.Text = \_File.Tag.Comment;
      }
      private void buttonSaveFile\_Click(object sender, EventArgs e)
      {
        \_File.Tag.Comment = textBox1.Text;
        \_File.Save();
      }
      
      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      I Didn't know that Library you used. I think this one is more easy to try A library to simplify access to image metadata[^]

      1 Reply Last reply
      0
      • J joost versteegen

        When I try to write to a comment tag field and save the file, I get either expected result, wrong result or an error. Does anyone have suggestions or tips? The intent is to add text to the metadata of jpg images so that I can search images later. Here's the code sofar:

        private void buttonOpenFile\_Click(object sender, EventArgs e)
        {
          using(OpenFileDialog d = new OpenFileDialog())
          {
            d.InitialDirectory = @"D:\\";
            d.Filter = "All jpeg files|\*.jpg;\*.jpeg";
            d.ShowDialog();
            \_File = TagLib.File.Create(d.FileName,"image/jpeg", TagLib.ReadStyle.None);
          }
          textBox1.Text = \_File.Tag.Comment;
        }
        private void buttonSaveFile\_Click(object sender, EventArgs e)
        {
          \_File.Tag.Comment = textBox1.Text;
          \_File.Save();
        }
        
        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Study the library web site Example https://github.com/mono/taglib-sharp/blob/master/examples/SetPictures.cs[^]

        J 1 Reply Last reply
        0
        • L Lost User

          Study the library web site Example https://github.com/mono/taglib-sharp/blob/master/examples/SetPictures.cs[^]

          J Offline
          J Offline
          joost versteegen
          wrote on last edited by
          #4

          I already studied all i could find...no solution sofar!

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups