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
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.
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)
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.
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With