Wednesday, July 7, 2010

reWorking: ExifLib — A Fast Exif Data Extractor for .NET and Silverlight

As soon as I began to get what a fabulous new technology Microsoft have developed in Silverlight, I decided to come up with something useful that I could implement with it — mostly just to get hands-on experience with the technology. Most people know that you can use Silverlight to create Rich Internet Applications (RIAs) and also "Apps" that run in smart phones… but one of the most intriguing things about Silverlight is that with the click of a configuration checkbox that same code can also run standalone — in so-called OOB (or "Out of Browser") mode —  on Windows, Mac OS X, and on many other platforms. So from the beginning I set my sights on creating “an App for that” which would do something useful with snapshots produced by digital cameras.

So I read with great interest the article by Simon McKenzie from Oct 2009 called “ExifLib — A Fast Exif Data Extractor for .NET 2.0” because “Exif Data” refers to the metadata stored in picture files by most digital cameras. Examples of this metadata are the properties that record what the camera settings were plus the date/time when the snapshot was taken — as you see in the ToolTip screen shot on the right. So imagine my disappointment when the article said that this ExifLib wouldn't work with the .NET libraries found in Silverlight 4 (because Silverlight comprises only a subset of the 'full' .NET platform). In McKenzie's defense, he did outline what one would have to do in order to "bridge the gap", so I set about doing exactly that; hense my release of the Silverlight version of this C# library which I recently posted back to the forum (www.codeproject.com) from whence it came.

To download the C# + Visual Studio 2010 project for this library, see: http://bit.ly/Exif-Silverlight-zip

Working on this project… I spent a majority of my time finding a panoply of different .jpg's from many different digital cameras — old and new — to make sure that my modifications not only worked for my pictures, but also for "everything" I could get my hands on. So aside from the code changes, in the new project, I've included this set of .jpg's (Big-endian and Little-endian) along with all of the regression testing data that I accumulated to ensure that the Silverlight and non-Silverlight versions of this library produce exactly the same results. From my project you can build either version of the library by just defining a conditional compilation that I made up.

Of course… please contact me if you find any flaws in this library since I am in the process of using it for a new Silverlight Application that — after its Bastille Day beta test began — I have now written about, here.

No comments:

Post a Comment