.Net 最好的 EXIF 库是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42017/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 09:42:49  来源:igfitidea点击:

What is the best EXIF library for .Net?

.netexif

提问by Jakub ?turc

I am looking for simple straightforward solution for accessing EXIF information of jpeg images in .Net. Does anybody has experience with this?

我正在寻找简单直接的解决方案来访问 .Net 中 jpeg 图像的 EXIF 信息。有没有人有这方面的经验?

回答by Rowland Shaw

If you're compiling against v3 of the Framework (or later), then you can load the images using the BitmapSourceclass, which exposes the EXIF metadata through the Metadataproperty

如果您正在针对框架的 v3(或更高版本)进行编译,那么您可以使用BitmapSourceclass加载图像,该类通过属性公开 EXIF 元数据Metadata

回答by Drew Noakes

If you're willing to use an open-source library, may I humbly suggest one of my own creation?

如果您愿意使用开源库,我可以谦虚地推荐一个我自己的作品吗?

The metadata-extractorproject has been alive and well since 2002 for Java, and is now available for .NET.

自 2002 年以来,元数据提取器项目一直活跃于 Java,现在可用于 .NET。

  • Open source (Apache 2.0)
  • Heavily tested and widely used
  • Supports many image types (JPEG, TIFF, PNG, WebP, GIF, BMP, ICO, PCX...)
  • Supports many metadata types (Exif, IPTC, XMP, JFIF, ...)
  • Supports many manufacturer-specific fields (Canon, Nikon, ...)
  • Very fast (fully processes ~400 images totalling 1.33GB in ~3 seconds) with low memory consumption
  • Builds for .NET 3.5, .NET 4.0+ and PCL
  • 开源(Apache 2.0)
  • 经过大量测试和广泛使用
  • 支持多种图像类型(JPEG、TIFF、PNG、WebP、GIF、BMP、ICO、PCX...)
  • 支持多种元数据类型(Exif、IPTC、XMP、JFIF...)
  • 支持许多特定于制造商的领域(佳能、尼康……)
  • 非常快(在约 3 秒内完全处理约 400 张图像,总计 1.33GB),内存消耗低
  • 为 .NET 3.5、.NET 4.0+ 和 PCL 构建

It's available via NuGetor GitHub.

它可以通过NuGetGitHub 获得

Sample usage:

示例用法:

IEnumerable<Directory> directories = ImageMetadataReader.ReadMetadata(path);

foreach (var directory in directories)
foreach (var tag in directory.Tags)
    Console.WriteLine($"{directory.Name} - {tag.TagName} = {tag.Description}");

回答by David Pierson

A new and very fast library is ExifLib - A Fast Exif Data Extractor for .NET 2.0by Simon McKenzie. I ended up using this one and the code is easy to use and understand. I used it for an app to rename according to the date taken. I wonder how many times such an app has been written.

一个新的非常快速的库是ExifLib -Simon McKenzie 的用于 .NET 2.0快速 Exif 数据提取器。我最终使用了这个,代码易于使用和理解。我将它用于应用程序,根据拍摄日期重命名。我想知道这样的应用程序被编写了多少次。

My tip: Make sure to call Dispose on the ExifReader objects once you've finished with them or the files remain open.

我的提示:确保在处理完 ExifReader 对象或文件保持打开状态后对它们调用 Dispose。

回答by David Pierson

I like Atalasoft's DotImage Photo, but its a closed source solution and costs about 600 per dev license.

我喜欢Atalasoft 的 DotImage Photo,但它是一个闭源解决方案,每个开发许可证的成本约为 600。

You can also check out DTools at Codeplex, which is an open source framework designed to supplement the standard Fx. It includes some Exif related classes.

您还可以在 Codeplex 上查看DTools,这是一个旨在补充标准 Fx 的开源框架。它包括一些与 Exif 相关的类。

回答by MikeScott8

the one I have saved in feeddemon for me to check out more when I have time (when is that for a programmer? LOL) is below

我在 feeddemon 中保存的一个,当我有时间时可以查看更多(程序员什么时候?大声笑)在下面

ExifTagCollection - EXIF Metadata extraction library

ExifTagCollection - EXIF 元数据提取库

Mike

麦克风

回答by Dave Griffiths

Check out this metadata extractor. It is written in Java but has also been ported to C#. I have used the Java version to write a small utility to rename my jpeg files based on the date and model tags. Very easy to use.

看看这个元数据提取器。它是用 Java 编写的,但也已移植到 C#。我已经使用 Java 版本编写了一个小实用程序来根据日期和型号标签重命名我的 jpeg 文件。非常容易使用。

回答by richardtallent

Several years ago, I started a little JPEG EXIF app with Omar Shahine to work on JPEG EXIF files, called JpegHammer.

几年前,我与 Omar Shahine 一起开发了一个小 JPEG EXIF 应用程序,用于处理 JPEG EXIF 文件,称为 JpegHammer。

He extracted from that project a library and called it PhotoLibrary, it was an easy .NET wrapper for the EXIF 2.2 tags. Unfortunately, the GotDotNet site is gone, CodePlex doesn't have it, Omar's web site links don't work, and I don't have a copy anymore.

他从该项目中提取了一个库并将其命名为 PhotoLibrary,它是 EXIF 2.2 标签的简单 .NET 包装器。不幸的是,GotDotNet 站点不见了,CodePlex 没有它,Omar 的网站链接不起作用,我也没有副本了。

But, if you can dig around Google, maybe you'll find it and it'll do the trick for you.

但是,如果您可以在 Google 周围挖掘,也许您会找到它并且它会为您解决问题。