本文介绍了IPTC .NET读/写C#库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在找一些库,从JPG文件读/写IPTC元数据。开源或付费的,无所谓。
I am looking for some library to read/write IPTC metadata from Jpg files. Open source or paid, doesn't matter.
这应与.NET 3.5和C#。
It should work with .NET 3.5 and c#.
有谁知道这样的图书馆吗?我用Google搜索,但没有发现任何东西。
Does anybody know such a library? I googled but haven't found anything.
推荐答案
http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.aspx
using System;
using System.IO;
using System.Linq;
using System.Windows.Media.Imaging;
namespace wictest
{
class Program
{
static void Main(string[] args)
{
var stream = new FileStream("1.jpg", FileMode.Open, FileAccess.Read);
var decoder = new JpegBitmapDecoder(stream, BitmapCreateOptions.None, BitmapCacheOption.None);
var metadata = decoder.Frames[0].Metadata as BitmapMetadata;
if(metadata != null)
Console.WriteLine(metadata.Keywords.Aggregate((old, val) => old + "; " + val));
Console.ReadLine();
}
}
}
这篇关于IPTC .NET读/写C#库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!