After a long day and night of coding, I released version 0.8.0.0 of my Flickr Metadata Synchr tool on CodePlex this morning. I finally solved the long-standing problem I was having with the Windows Imaging Component (WIC) to update metadata. So this is the first fully-functional release of my application.
Functionality of FlickrMetadataSynchr v0.8.0.0
This is what the app does:
- It allows you to select a set of your photos on Flickr and a folder on your hard drive with images.
- It reads the metadata for both Flickr images and the local images. The metadata that is read is:
- Geo-info (GPS coordinates)
- Date and time taken
- Last update date and time
- It matches images on Flickr with local images based on the date and time taken.
- It determines on a per picture basis in what direction the metadata should by synced, i.e., which side should be updated, if any. Currently the most recently updated side wins. I am getting help from Timo Proescholdt for a better algorithm that will allow for a merge of metadata, i.e., a two-way synch.
- It updates the metadata on Flickr and in the local images.
This is a screenshot of the app:
Previous posts on this tool
- Here is more info on why and how you should store the metadata in your images.
- Read here how I was previously forced to use C++ to update metadata in images stored on the hard drive (I call these local images).
- Read about how CodePlex lost my source code.
Workaround for WIC problems
During my holiday in France in July I received e-mail from Robert A. Wlodarczyk who works at Microsoft. He pinged me to say that he had released new sample code to update metadata using WIC. Yesterday, I tried to incorporate similar code into my application and ran into the same type of problems as before.
Because his sample was working, I wasn't ready to give up again. I finally tracked the problem down to a threading issue. WIC is throwing strange InvalidOperationException and InvalidFormatException exceptions with messages like "Cannot write to the stream" when it is called from a background thread. My app is multi-threaded so that the UI doesn't hang when it is busy syncing.
After I got confirmation from Robert that WIC indeed suffers from a threading issue, I solved the problem with a work around. I now marshal the call to the code that uses WIC to update metadata to the UI thread using the WPF Dispatcher object. This causes the app to become non-responsive for small amounts of time during the update of local metadata. But that is better than a non-fully-functional app.
Fully functional, give it a try
So all is well that ends well. After finally getting WIC to work, I could do away with the C++ code that was causing me headaches 😉 And my app now works on Windows XP again. You just need to have the .NET Framework 3.0 installed.
If you have images on Flickr and you have been busy tagging them, give my app a spin! You can always find the latest release on CodePlex. The source code is also available under a GPL license on CodePlex.
Installing is easy. You just need to unzip the ZIP-file, which contains three files, to a folder. Start the FlickrMetadataSynchr.exe file and you are done. The app remembers the last settings.
If you find any issues, please report them using the Issue Tracker for my app on CodePlex.
Even though the app is now able to sync metadata in both Flickr images and local images, there is always room for improvement. Here are my ideas, some of which are based of suggestions by people on CodePlex:
- Improve the synchronization to also allow two-way synchronization for a picture pair. I.e., one side doesn't have to win. For example, if the Flickr image has just the title set and the local image the description, the metadata should be merged.
- Add UI to see the match that is made by the tool and how it proposes to sync the metadata.
- Allow you to exclude images if the match isn't good.
- Allow you to overrule the sync proposal and sync the metadata in a different direction (on a per property basis) .
- Add UI to store multiple mappings between Flickr sets and local folders. Currently the app only remembers the last folder and Flickr set that was used.
- Add click-once deployment. That way the app can automatically check for new versions and update itself.
If you have any other ideas please post them at the discussions page for my app on CodePlex.