Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EXIF library for .NET 4.0 framework [closed]

Tags:

c#

.net

exif

I've searched on this topic but the only suitable threads I can find are dated 2008 hence my new question.

I'm looking at developing a program using C# .Net 4.0 language. The aim of my program will be to extract EXIF information from jpegs (Manufacturer, Model, Geolocation info etc...) and then populate this into a MySql / Sql server DB.

Can anybody recommend any good libraries that may be suitable for this project? I would be looking for camera serial numbers too (I know this varies from manufacturer to manufacturer) but if anybody knows of any existing libraries that address this, it'd be most helpful.

Thanks and enjoy the weekend

like image 296
thefragileomen Avatar asked Aug 19 '11 22:08

thefragileomen


3 Answers

The metadata-extractor project has been alive and well since 2002 for Java, and is now available for .NET 3.5 and above. There is also a PCL version.

  • Open source (Apache 2.0)
  • Heavily tested and widely used
  • Supports many image types (JPEG, TIFF, PNG, WebP, GIF, BMP, ICO, PCX...)
  • Supports many metadata types (Exif, IPTC, XMP, JFIF, ...)
  • Supports many manufacturer-specific fields (Canon, Nikon, ...)
  • Very fast (fully processes ~400 images totalling 1.33GB in ~3 seconds) with low memory consumption

It's 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.WriteLine($"{directory.Name} - {tag.TagName} = {tag.Description}");

(Disclosure: I maintain this library)

like image 173
Drew Noakes Avatar answered Oct 24 '22 14:10

Drew Noakes


This CodeProject article was written just last month, and its API is a big improvement over some of the other .NET EXIF readers:

http://www.codeproject.com/Articles/36342/ExifLib-A-Fast-Exif-Data-Extractor-for-NET-2-0

It's also available over Nuget, and is licensed under the CPOL.

like image 27
Charlie Avatar answered Oct 24 '22 15:10

Charlie


For basic EXIF information(manufacturer, camera model, time, aperture, etc.), I would look at the System.Drawing.Image class - in particular the PropertiesItems collection.

There are disadvantages to this class. It requires loading the entire image into memory before retrieving the EXIF info (i.e. it is somewhat slow). It also does not handle all of the vendor specific fields that aren't uniform from camera to camera.

Image.PropertyItems

MSDN: Reading Image Metadata

PropertyItem.Id

I have used it with great success to collect information about my photo collection (tens of thousands of photos taken with a dozen different digital cameras of various makes and models).

like image 21
Jason Moore Avatar answered Oct 24 '22 14:10

Jason Moore