Skip to content

yjqGitHub/metadata-extractor-dotnet

 
 

Repository files navigation

metadata-extractor logo

Build status MetadataExtractor NuGet version Issue Stats

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

Installation

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

PM> Install-Package MetadataExtractor

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 will process files of type:

  • JPEG
  • TIFF
  • WebP
  • PSD
  • PNG
  • BMP
  • GIF
  • ICO
  • PCX
  • Camera Raw
    • NEF (Nikon)
    • CR2 (Canon)
    • ORF (Olympus)
    • ARW (Sony)
    • RW2 (Panasonic)
    • RWL (Leica)
    • SRW (Samsung)

Camera-specific "makernote" data is decoded for cameras manufactured by:

  • Agfa
  • Apple
  • Canon
  • Casio
  • Epson
  • Fujifilm
  • Kodak
  • Kyocera
  • Leica
  • Minolta
  • Nikon
  • Olympus
  • Panasonic
  • Pentax
  • Sanyo
  • Sigma/Foveon
  • Sony

Supported Frameworks

Multiple target frameworks are supported via the single NuGet package. This allows supports Xamarin for Android and iOS, as well as:

  • .NET Framework 3.5
  • .NET Framework 4.5
  • .NET Framework 4.5 (Portable)
  • Silverlight 5.0
  • Windows 8.0
  • Windows Phone 8.1
  • Windows Phone Silverlight 8.0

Note that the PCL version does not support file-system metadata due to restricted IO APIs.

Mailing List

The metadata-extractor-dev Google Group is for discussion about the development of the library and questions about its usage.

Feedback

Have questions or ideas? Try the mailing list or open an issue. GitHub's issue tracker accepts attachments, and sample images are often crucial in debugging problems.

Contribute

If you want to get your hands dirty, clone this repository, enhance the library and submit a pull request. Review the issue list and ask around on the mailing list to avoid duplication of work.

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. Both projects are now developed in unison and aim to be functionally equivalent.

License

Copyright 2002-2016 Drew Noakes

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

More information about this project is available at:

About

Extracts Exif, IPTC, XMP, ICC and other metadata from image and movie files

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%