IPTC .NET read/write c# library

后端 未结 1 1136
臣服心动
臣服心动 2020-12-31 17:33

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 a

相关标签:
1条回答
  • 2020-12-31 18:09

    *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.

    0 讨论(0)
提交回复
热议问题