metadata-extractor logo

home | software | metadata-extractor


Java
.NET Build status MetadataExtractor NuGet version

metadata-extractor lets you access the metadata in digital images and video via a simple API.

Supported Formats

Image file types:

Video file types:

Metadata formats:

Manufacturer makernote support:

A single image may contain multiple kinds of metadata.

Using this library

Printing out all metadata in a file

[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
...

Java

Metadata metadata = ImageMetadataReader.readMetadata(file);

for (Directory directory : metadata.getDirectories()) {
    for (Tag tag : directory.getTags()) {
        System.out.format("[%s] - %s = %s",
            directory.getName(), tag.getTagName(), tag.getDescription());
    }
    if (directory.hasErrors()) {
        for (String error : directory.getErrors()) {
            System.err.format("ERROR: %s", error);
        }
    }
}

C#

var directories = ImageMetadataReader.ReadMetadata(file);

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

    if (directory.HasError)
    {
        foreach (var error in directory.Errors)
            Console.WriteLine($"ERROR: {error}");
    }
}

Accessing the exposure time

Java

Metadata metadata = ImageMetadataReader.readMetadata(file);

ExifSubIFDDirectory directory = metadata.getFirstDirectoryOfType(ExifSubIFDDirectory.class);

Date date = directory.getDate(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL);

C#

var directories = ImageMetadataReader.ReadMetadata(file);

var subIfdDirectory = directories.OfType<ExifSubIfdDirectory>().FirstOrDefault();

var dateTime = subIfdDirectory?.GetDescription(ExifDirectoryBase.TagDateTime);

Contributing

There are several ways to get involved:

Contact with users and contributors encourages and motivates me to keep making improvements.

Help

Ask a question on Stack Overflow using the metadata-extractor tag, or try the mailing list (see below).

Java

Read the wiki, Javadoc and sample code.

.NET

The sample code above and the readme is enough to get started. Why not contribute to the project wiki, or open a pull request with some sample code?

Mailing List

metadata-extractor-dev is a Google Group that hosts discussion about the development of the library and questions about its usage.

Download

Java

You may use the project via Maven.

Alternatively, download the source and/or compiled binaries from the releases page.

.NET

The library is available on NuGet:

Install-Package MetadataExtractor

The NuGet package targets .NET 4.5, .NET 3.5, Silverlight 5.0, Windows 8.0+, Windows Phone 8.1+ and Windows Phone Silverlight 8.0

History

The library started out in 2002 in Java. It's been actively developed since then. In 2015 the first .NET version was created.

Java

Change log and GitHub releases.

.NET

Releases are listed on NuGet and GitHub.

License

You may use this library within the terms of the Apache License 2. Please send me a short email to let me know if you find it useful.

You are free to sell work based upon this library, though please consider making a donation.

Donate

If you've found this library useful and would like to thank the author, you can make a donation to show your appreciation for the many hours spent on this project.