IPTC .NET read/write c# library

痞子三分冷 提交于 2019-12-18 13:18:00

问题


I am looking for some library to read/write IPTC metadata from Jpg files. Open source or paid, doesn't matter.

It should work with .NET 3.5 and c#.

Does anybody know such a library? I googled but haven't found anything.


回答1:


*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();
        }
    }
}

You need to reference PresentationCore.dll and WindowsBase.dll to get access to the System.Windows.Media namespace.



来源:https://stackoverflow.com/questions/5597079/iptc-net-read-write-c-sharp-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!