Deep Zoom Batch Export using C# - Update
In a previous post I’ve showed how to automate the exporting process of a DeepZoom composition or collection. Meanwhile the Microsoft DeepZoom Composer tool has been updated (and new features have been added too!), breaking my previous sample.
Given the positive feedbacks I received from the previous post, I’ve decided to do some refactoring and updates to the previous solution. The current implementation include:
- Class Library: it encapsulate all the wrapping methods of the SparseImageTool.
- Test Project: it shows how to use the library. The library can be used from WindowsForms/WPF/ASP.NET….as long as the machine has the SparseImageTool installed.
You can download the updated library and source code here.
The new class diagram is like so:
Given a directory containing all the images and a name for the collection, it’s now really easy to create programmatically a collection.
1: static void CreateCollection(string collectionName, string sourceImagesFolder, string outputFolder)
2: {
3: // Create a collection converter
4: CollectionConverter collectionConverter = new CollectionConverter();
5: // Required parameters
6: collectionConverter.SparseImageToolPath = GetSparseImageToolPath();
7: collectionConverter.ImagesCollection = GetImages(sourceImagesFolder); // IEnumerable<string> containing the path of the images
8: collectionConverter.ImagesDestinationFolder = outputFolder;
9: // Optional parameters
10: collectionConverter.CollectionName = collectionName;
11: collectionConverter.CollectionFormat = CollectionConverter.CollectionFormats.XML;
12: //collectionConverter.ConvertedOverlapPixels = ...
13: //collectionConverter.ConvertedTileSize = ...
14: //TODO: You can customize the exporting experience here, by setting the according parameters such as:
15: // Tile Size, File Format, Collection Format, Compression, Quality, ...
16:
17: // Attach to completion handler
18: collectionConverter.BatchCompleted += delegate
19: {
20: Console.WriteLine("Conversion completed\nPRESS <ENTER> TO EXIT");
21: };
22:
23: try
24: {
25: collectionConverter.BatchCollectionExport();
26: }
27: catch (Exception e)
28: {
29: Console.WriteLine(e.Message);
30: }
31:
32: Console.WriteLine("Conversion started...");
33: Console.ReadLine();
34: }
You can download the updated library and source code here.
Have fun!
Technorati Tags: Silverlight,Deep Zoom,C#
Comments
Anonymous
August 25, 2008
PingBack from http://informationsfunnywallpaper.cn/?p=2261Anonymous
September 04, 2008
I don't know how to use the output of this library. Isn't there a metadata.xml missing?Anonymous
October 07, 2008
The output of the library is the same as if exported from DeepZoom Composer. You will then need to create a Silverlight app to show the composition. G.Anonymous
October 14, 2008
Hello Giorgio Sardo. Thanks for the good article. I have a problem with this. I trying to use your program on my asp.net web server. when I'm testing on my WebDev Server(VS 2008) it works fine. but on my IIS(IIS7.0 ,windows server 2008). it doesn't works. I tried on three ways.
- web.cofig system.web identity impersonate true
- machine.config processModel change username
- give a 'xml and sparseimagetool' access authority to asp.net user(NETWORK SERVICE and etc) but still don't know why. can't figure out. I'm struggling about 3days on this. could you give me a any advice? It will helps me a lot. thank you
Anonymous
November 07, 2008
digg_url = 'http://digg.com/politics/730_Obama_Newspapers_from_66_Countries_DeepZoom_Collection'; I don'tAnonymous
November 07, 2008
digg_url = 'http://digg.com/politics/730_Obama_Newspapers_from_66_Countries_DeepZoom_Collection'; I donAnonymous
May 04, 2009
Thanks Giorgio! I was looking for this since long. The Deep Zoom Composer provides a manual interface for creating collections, but it is often required in applications to programmatically create collections and expose to web. Thanks for this article.Anonymous
May 04, 2009
Just a update... Your application uses SparseImageTool.exe, which is not shipped now. Instead <a href='http://blogs.msdn.com/expression/archive/2008/11/26/hello-deepzoomtools-dll-deep-zoom-image-tile-generation-made-easy.aspx' title='DeepZoomTools.dll'>DeepZoomTools.dll</a> is used for creating image collections programmatically. Thanks!Anonymous
May 04, 2009
Thank you Sandeep, you are right. The DeepZoom team recently built a managed library to create dinamic composition (which wasn't available when I've first written this post). :) Have a good zoom! :DAnonymous
November 03, 2009
can't do the update with deepzoomtools.dll !?Anonymous
January 12, 2010
For me, this is very exciting, I like this style, I hope to be able to see more 斯蒂芬