- Notifications
You must be signed in to change notification settings - Fork180
Extracts Exif, IPTC, XMP, ICC and other metadata from image, video and audio files
License
drewnoakes/metadata-extractor-dotnet
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
MetadataExtractor is a straightforward .NET library for reading metadata from image, movie and audio files.
The easiest way to use this library is via itsNuGet package.
Either add this to your project file
<ItemGroup> <PackageReferenceInclude="MetadataExtractor"Version="2.8.1" /></ItemGroup>
Or type this in Visual Studio's Package Manager Console:
PM> Install-Package MetadataExtractor
Or search forMetadataExtractor
in the Visual Studio NuGet Package Manager.
IEnumerable<Directory>directories=ImageMetadataReader.ReadMetadata(imagePath);
The resultingdirectories
sequence holds potentially many different directories of metadata, depending upon the input image.
To print out all values from all directories:
foreach(vardirectoryindirectories)foreach(vartagindirectory.Tags)Console.WriteLine($"{directory.Name} -{tag.Name} ={tag.Description}");
Producing:
Exif SubIFD - Exposure Time = 1/60 secExif SubIFD - F-Number = f/8.0...Exif IFD0 - Make = NIKON CORPORATIONExif IFD0 - Model = NIKON D70...IPTC - Credit = Drew NoakesIPTC - City = London...
Access a specific value, in this case the Exif DateTime tag:
varsubIfdDirectory=directories.OfType<ExifSubIfdDirectory>().FirstOrDefault();vardateTime=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:
- Agfa
- Apple
- Canon
- Casio
- DJI
- Epson
- FLIR
- Fujifilm
- Kodak
- Kyocera
- Leica
- Minolta
- Nikon
- Olympus
- Panasonic
- Pentax
- Reconyx
- Ricoh
- Samsung
- Sanyo
- Sigma/Foveon
- Sony
This library targets:
- .NET 8.0 (
net8.0
) - .NET Standard 2.0 (
netstandard2.0
) - .NET Standard 2.1 (
netstandard2.1
)
All target frameworks are provided via theone NuGet package.
net8.0
implements .NET 8, including support for NativeAOT.
netstandard2.0
implements version 2.0 of the.NET Standard which covers .NET Framework and .NET Core.
netstandard2.1
implements version 2.1 of the .NET Standard, which uses newer APIs where possible.
Support for older targets in previous versions
A PCL build was supported untilversion 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.
A
netstandard1.3
build was supported untilversion 2.8.1. Support for this framework was dropped in mid 2025 in response to Microsoft advisoryNETSDK1215 (since .NET SDK 9).A
net462
build was supported untilversion 2.8.1. This target became obsolete with the introduction ofnetstandard2.0
.A
net3.5
build was supported untilversion 2.8.1. Support for this framework was dropped in early 2024 to enable use of newer, more efficient, .NET APIs.
Building this repo requires a recent version of Visual Studio 2022. Ensure you have the.NET Core Development Tools workload installed via the Visual Studio Installer.
The library itself, once built, may be consumed from projects in much earlier versions of Visual Studio.
The quickest way to have your questions answered is viaStack Overflow.Check whether your question has already been asked, and if not, ask a new one tagged with bothmetadata-extractor
and.net
.
Bugs and feature requests should be provided via the project'sissue 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 thesample image file library used for research and testing.
This library is developed byDrew Noakes and contributors.
Thanks are due to the manyusers 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 wasoriginally 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.
- Javametadata-extractor is the original implementation of this project, from which this .NET version was ported
- PHPphp-metadata-extractor wraps the Java project, making it available to users of PHP
More information about this project is available at:
About
Extracts Exif, IPTC, XMP, ICC and other metadata from image, video and audio files
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.