MetadataExtractor 2.8.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package MetadataExtractor --version 2.8.0                
NuGet\Install-Package MetadataExtractor -Version 2.8.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MetadataExtractor" Version="2.8.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MetadataExtractor --version 2.8.0                
#r "nuget: MetadataExtractor, 2.8.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MetadataExtractor as a Cake Addin
#addin nuget:?package=MetadataExtractor&version=2.8.0

// Install MetadataExtractor as a Cake Tool
#tool nuget:?package=MetadataExtractor&version=2.8.0                

metadata-extractor logo

Build Status MetadataExtractor NuGet version MetadataExtractor on fuget.org MetadataExtractor NuGet download count

MetadataExtractor is a straightforward .NET library for reading metadata from image, movie and audio files.

Installation

The easiest way to use this library is via its NuGet package.

Either add this to your project file

<ItemGroup>
    <PackageReference Include="MetadataExtractor" Version="2.8.0" />
</ItemGroup>

Or type this in Visual Studio's Package Manager Console:

PM> Install-Package MetadataExtractor

Or search for MetadataExtractor in the Visual Studio NuGet Package Manager.

Usage

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

The resulting directories sequence 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<ExifSubIfdDirectory>().FirstOrDefault();
var dateTime = subIfdDirectory?.GetDescription(ExifDirectoryBase.TagDateTime);

Features

The library understands several formats of metadata, many of which may be present in a single image:

It supports various file types.

  • Images

    • BMP
    • EPS
    • GIF
    • HEIF / HEIC
    • ICO
    • JPEG / JFIF
    • Netpbm
    • PCX
    • PNG
    • PSD
    • TGA
    • TIFF / BigTIFF
    • WebP
    • Camera Raw
      • ARW (Sony)
      • CR2 (Canon)
      • NEF (Nikon)
      • ORF (Olympus)
      • RW2 (Panasonic)
      • RWL (Leica)
      • SRW (Samsung)
  • Movies

    • AVCI
    • AVI
    • MOV (QuickTime)
    • MP4
  • Audio

    • WAV
    • MP3

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
  • Sanyo
  • Sigma/Foveon
  • Sony

Supported Frameworks

This library targets:

  • .NET Framework 3.5 (net35)
  • .NET Framework 4.5 (net45)
  • .NET Standard 1.3 (netstandard1.3)
  • .NET Standard 2.0 (netstandard2.0)

All target frameworks are provided via the one NuGet package.

net35 and net45 target the full .NET Framework. net45 uses the newer IReadOnlyList<> on some public APIs where net35 uses IList<>. Internally net45 also uses some newer library features for slightly improved performance.

netstandard1.3 implements 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.

Building

Building this repo requires a recent version of Visual Studio 2019. 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.

Questions & Feedback

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-extractor and .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.

Contributing

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.

Credits

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.

Other languages

  • Java metadata-extractor is the original implementation of this project, from which this .NET version was ported
  • PHP php-metadata-extractor wraps the Java project, making it available to users of PHP

More information about this project is available at:

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp1.0 was computed.  netcoreapp1.1 was computed.  netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard1.3 is compatible.  netstandard1.4 was computed.  netstandard1.5 was computed.  netstandard1.6 was computed.  netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net35 is compatible.  net40 was computed.  net403 was computed.  net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen30 was computed.  tizen40 was computed.  tizen60 was computed. 
Universal Windows Platform uap was computed.  uap10.0 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (25)

Showing the top 5 NuGet packages that depend on MetadataExtractor:

Package Downloads
FenixAlliance.ACL.Dependencies

Application Component for the Alliance Business Suite.

Apalla.Bubu.Shared

Bubu is application framework to easily build crossplatform applications. Apalla.Bubu.Shared contains general classes for all application types and platforms.

MudBlazor.Extensions

MudBlazor.Extensions is a small extension library for MudBlazor from https://mudblazor.com/

Wyam.Xmp

Wyam is a simple to use, highly modular, and extremely configurable static content generator. This library provides support for analyzing XML metadata.

Dynamicweb.Imaging.Providers.MetadataExtractorProviders

MetadataExtractor providers for image metadata handling

GitHub repositories (11)

Showing the top 5 popular GitHub repositories that depend on MetadataExtractor:

Repository Stars
LykosAI/StabilityMatrix
Multi-Platform Package Manager for Stable Diffusion
ElevenPaths/FOCA
Tool to find metadata and hidden information in the documents.
Webreaper/Damselfly
Damselfly is a server-based Photograph Management app. The goal of Damselfly is to index an extremely large collection of images, and allow easy search and retrieval of those images, using metadata such as the IPTC keyword tags, as well as the folder and file names. Damselfly includes support for object/face detection.
n00mkrad/text2image-gui
Somewhat modular text2image GUI, initially just for Stable Diffusion
statiqdev/Statiq.Framework
A flexible and extensible static content generation framework for .NET.