使用C#中基于ImageMagick的库C#将EXIF元数据添加到当前没有EXIF配置文件的已处理JPEG中。创建配置文件的尝试都失败了:
var newExifProfile = image.GetExifProfile();
if (newExifProfile == null)
{
newExifProfile = new ExifProfile();
}
newExifProfile.SetValue(ExifTag.Copyright, "test");ExifProfile有接受流或字节数组的其他构造函数,而不提供每当调用.SetValue()时都会创建异常:
对象引用未设置为对象的实例。ImageMagick.ExifReader.GetBytes(UInt32 length) at ImageMagick.ExifReader.Read(Byte[] data) at ImageMagick.ExifProfile.SetValue(ExifTag标记,Object value)
如何使用Magick.NET编写EXIF数据?
发布于 2014-07-24 05:03:23
您在Magick.NET中发现了一个bug,并且已经修复(https://magick.codeplex.com/workitem/1272)。使用Magick.NET的下一个版本(6.8.9.601),您将能够这样做:
using (MagickImage image = new MagickImage("logo:"))
{
profile = new ExifProfile();
profile.SetValue(ExifTag.Copyright, "Dirk Lemstra");
image.AddProfile(profile);
image.Write("logo.withexif.jpg");
}https://stackoverflow.com/questions/24916253
复制相似问题