6

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.

bubbleking
  • 3,329
  • 3
  • 29
  • 49
dkpatt
  • 580
  • 5
  • 12

6 Answers6

3

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

Community
  • 1
  • 1
Mark Redman
  • 24,079
  • 20
  • 92
  • 147
  • 1
    I can verify this works wonderfully! Many manufacturers store most of the useful Exif data in the `Makernote` field. This tool parses all that into a nice little XML-friendly dictionary full of Exif tags. – glenneroo Jan 09 '11 at 22:12
  • This is an outdated port of my _metadata-extractor_ project. I now maintain an official C# version which has more features and many bug fixes. See [my answer](http://stackoverflow.com/a/32771543/24874) for more info. – Drew Noakes Sep 24 '15 at 21:55
2

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.

Rowland Shaw
  • 37,700
  • 14
  • 97
  • 166
2

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.

Community
  • 1
  • 1
Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
1

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.

Community
  • 1
  • 1
Oded
  • 489,969
  • 99
  • 883
  • 1,009
1

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

Community
  • 1
  • 1
glenneroo
  • 1,908
  • 5
  • 30
  • 49
0

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.

markp3rry
  • 724
  • 10
  • 26
  • Hi markp3rry!, I am also dealing with same kind of project. I am able to get EXIF data of image but I also need the APP1 format data, Are you getting that data too?, If so then can you please share here how to get that data? – Som Jan 09 '19 at 14:10