【问题标题】:How to add a Custom MetaData to a PNG or JPG file如何将自定义元数据添加到 PNG 或 JPG 文件
【发布时间】:2022-01-04 08:54:47
【问题描述】:

我可以使用 taglib 库将自定义元数据添加到 mp3 mp4 格式,但我不能使用 taglib 库将自定义元数据添加到 jpg、png 格式 如何将自定义元数据添加到 png 或 jpg 文件?

【问题讨论】:

标签: c# png metadata jpeg taglib


【解决方案1】:

这里有官方示例: 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();

应该可以正常工作。

【讨论】:

  • 我无法添加自定义元
  • @MehmetCeylan 任何细节?
  • 我要制作 tfile.Tag.["MyAttribute"]="Custom Data";
猜你喜欢
  • 2016-02-10
  • 1970-01-01
  • 2011-07-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-04-13
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多