Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Retrieve Canon Specific EXIF Data

Tags:

c#

.net

exif

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.

like image 206
dkpatt Avatar asked Apr 25 '10 06:04

dkpatt


2 Answers

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

like image 94
Mark Redman Avatar answered Oct 12 '22 21:10

Mark Redman


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.

like image 43
Rowland Shaw Avatar answered Oct 12 '22 22:10

Rowland Shaw