dkpatt
dkpatt

Reputation: 580

C# Retrieve Canon Specific EXIF Data

I have written an app that reads the basic EXIF data from an image via the PropertyItems exposed in .Net's System.Drawing.Image class. However, I cannot retrieve Canon specific EXIF data via these properties. How does one read this information? I know it exists in the file, as Photoshop reads it.

Upvotes: 6

Views: 3672

Answers (6)

Mark Redman
Mark Redman

Reputation: 24535

I found this a while ago but haven't used it yet. It looked like it had manufacturer specific info.

http://renaud91.free.fr/MetaDataExtractor/

UPDATE:

The metadata-extractor project has been alive and well since 2002 for Java, and is now available for .NET. It has comprehensive support for Canon's makernotes as well as those from Agfa, Casio, Epson, Fujifilm, Kodak, Kyocera, Leica, Minolta, Nikon, Olympus, Panasonic, Pentax, Sanyo, Sigma/Foveon and Sony cameras and scanners.

You can browse example output for several Canon (and other) camera images here.

The library is available via NuGet or GitHub.

Sample usage:

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

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

see an updated answer here: C# Retrieve Canon Specific EXIF Data

Upvotes: 3

Drew Noakes
Drew Noakes

Reputation: 311245

The metadata-extractor project has been alive and well since 2002 for Java, and is now available for .NET. It has comprehensive support for Canon's makernotes as well as those from Agfa, Casio, Epson, Fujifilm, Kodak, Kyocera, Leica, Minolta, Nikon, Olympus, Panasonic, Pentax, Sanyo, Sigma/Foveon and Sony cameras and scanners.

You can browse example output for several Canon (and other) camera images here.

The library is available via NuGet or GitHub.

Sample usage:

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

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

Note that the lib in Mark Redman's answer is an outdated port of my Java library from many years ago. I now maintain both the C# and Java projects to have feature parity.

Upvotes: 2

markp3rry
markp3rry

Reputation: 734

I wrote a forensic tool a few months ago in C# and used Phil Harvey's EXIF Tool to get the EXIF data from photographs. Yep, it's a PERL library but it was really easy to install and integrate into my C# application.

Upvotes: 0

glenneroo
glenneroo

Reputation: 2054

If they are RAW files, you could try using dcraw.net to get the information out.

Upvotes: 1

Rowland Shaw
Rowland Shaw

Reputation: 38130

If you're compiling against v3 of the Framework (or later), then you can load the images using the BitmapSource class, which exposes the EXIF metadata through the Metadata property. This gives a much closer connection to the EXIF information in the pictures, although the maker notes are specific and will need further decoding.

Upvotes: 2

Oded
Oded

Reputation: 499152

There isn't anything built into the BCL that will help with EXIF.

Look at this SO question and the answers (What is the best EXIF library for .Net?). There are several commercial and open source libraries that you can use to get EXIF data.

Upvotes: 1

Related Questions