Extracts Exif, IPTC, XMP, ICC and other metadata from image, video and audio files
MetadataExtractor is a straightforward .NET library for reading metadata from image, movie and audio files.
The easiest way to use this library is via its NuGet package.
Either add this to your project file
Or type this in Visual Studio's Package Manager Console:
PM> Install-Package MetadataExtractor
Or search for
MetadataExtractorin the Visual Studio NuGet Package Manager.
IEnumerable directories = ImageMetadataReader.ReadMetadata(imagePath);
The resulting
directoriessequence holds potentially many different directories of metadata, depending upon the input image.
To print out all values from all directories:
foreach (var directory in directories) foreach (var tag in directory.Tags) Console.WriteLine($"{directory.Name} - {tag.Name} = {tag.Description}");
Producing:
Exif SubIFD - Exposure Time = 1/60 sec Exif SubIFD - F-Number = f/8.0 ... Exif IFD0 - Make = NIKON CORPORATION Exif IFD0 - Model = NIKON D70 ... IPTC - Credit = Drew Noakes IPTC - City = London ...
Access a specific value, in this case the Exif DateTime tag:
var subIfdDirectory = directories.OfType().FirstOrDefault(); var dateTime = subIfdDirectory?.GetDescription(ExifDirectoryBase.TagDateTime);
The library understands several formats of metadata, many of which may be present in a single image:
It supports various file types.
Images
Movies
Audio
Camera-specific "makernote" data is decoded for cameras manufactured by:
This library targets:
net35)
net45)
netstandard1.3)
netstandard2.0)
All target frameworks are provided via the one NuGet package.
net35and
net45target the full .NET Framework.
net45uses the newer
IReadOnlyList<>on some public APIs where
net35uses
IList<>. Internally
net45also uses some newer library features for slightly improved performance.
netstandard1.3implements version 1.3 of the .NET Standard which covers .NET Core, Mono, Xamarin platforms, UWP, and future platforms.
A PCL build was supported until version 1.5.3 which supported Silverlight 5.0, Windows 8.0, Windows Phone 8.1 and Windows Phone Silverlight 8.0. PCL versions did not support file-system metadata due to restricted IO APIs.
If using Visual Studio to compile this repo, ensure you have the .NET Core Development Tools workload installed. This can be verified and corrected using the Visual Studio Installer in VS2017 and later.
The quickest way to have your questions answered is via Stack Overflow. Check whether your question has already been asked, and if not, ask a new one tagged with both
metadata-extractorand
.net.
Bugs and feature requests should be provided via the project's issue tracker. Please attach sample images where possible as most issues cannot be investigated without an image.
If you want to get your hands dirty, making a pull request is a great way to enhance the library. In general it's best to create an issue first that captures the problem you want to address. You can discuss your proposed solution in that issue. This gives others a chance to provide feedback before you spend your valuable time working on it.
An easier way to help is to contribute to the sample image file library used for research and testing.
This library is developed by Drew Noakes and contributors.
Thanks are due to the many users who sent in suggestions, bug reports, sample images from their cameras as well as encouragement. Wherever possible, they have been credited in the source code and commit logs.
This library was originally written in Java in 2002. In 2014, Yakov Danilov (for Imazen LLC) converted the code to C# using Sharpen. The code has subsequently been edited to provide a more idiomatic .NET API. Both projects are now developed in unison and aim to be functionally equivalent.
More information about this project is available at: