How to add a Custom MetaData to a PNG or JPG file

1.3k Views Asked by At

I can add custom meta data to mp3 mp4 formats with the taglib library but i cant add custom meta data to jpg, png formats with the taglib library How to add a custom metada to png or jpg file?

1

There are 1 best solutions below

3
Jakub On

Here you've got official examples: https://github.com/mono/taglib-sharp

var tfile = TagLib.File.Create(@"C:\My picture.jpg");
string title = tfile.Tag.Title;
var tag =  tfile.Tag as TagLib.Image.CombinedImageTag;
DateTime? snapshot = tag.DateTime;
Console.WriteLine("Title: {0}, snapshot taken on {1}", title, snapshot);

// change title in the file
tfile.Tag.Title = "my new title";
tfile.Save();

Should work just fine.