Monday, March 1, 2010
Thursday, February 11, 2010
Sunday, July 6, 2008
Saturday, June 21, 2008
The SparseImageTool.exe now generates dzc_output.xml file instead of items.bin file. The other output files that are generated are
Metadata.xml has the metadata information about all the images. These include the x,y position and height, width of the images. The earlier versions of the Deep Zoom Composer flattened the images on the artboard as a JPEG image. The upgraded version allows flattening the images in PNG format as well.
Check out the Expression Team Blog for more detailed information on What's new in the upgraded version of Deep Zoom Composer.
Sunday, June 15, 2008
My last post was on using Deep Zoom Composer.
Notice that now I have selected "Export Images and Silverlight Project". You get
When "View Project Folder" is clicked,
Deep Zoom Composer generates code for the Deep Zoom Collection. It adds Web for hosting the Silverlight control. The ClientBin folder now has the Deep Zoom generated images and the SparseImageSceneGraph.xml file.
The Deep Zoom Image can be accessed using MultiScaleImage control in Silverlight. It is accessed in XAML as
<MultiScaleImage Source="GeneratedImages/dzc_output/items.bin" Height="440" x:Name="msi" />
The MouseMove event saves the current position and pans to the new position when mouse is dragged. The MouseLeftButtonDown saves the inital dragOffset and currentPosition in case the user pans. It is the MouseLeftButtonUp that zooms into the image in case the user is not completing a pan. It also resets the mouse. MouseWheelHelper(msi).Moved zooms in or out depending on the mouse wheel direction.
ArrangeIntoGrid method arranges the images into a grid provided they are all of same size. It gets a randomised list of images and arranges them into a grid of 4 columns. The number of rows is calculated based on number of images in the collection. Hit on F5 and you should see a grid of images into which you can zoom in and out. You can pan the images as well. In addition, you can hit on Randomize button to rearrange the images in a different fashion.
There! This should get one started on programming more functionality using this wonderful technology.
Have fun coding! :-)
Saturday, June 14, 2008
I had been blogging on Deep Zoom, but there's no entry on how to use Deep Zoom Composer. So in this blog entry, I am going to take you through the usage of Deep Zoom Composer.
Note: I have still not used the most recent version of Deep Zoom Composer (0.9.000.3)....the one that was released along with Silverlight 2 Beta 2. This blog entry corresponds to the previous version of Deep Zoom Composer. I don't think it is available online. You can get it from here. I will blog on this update to the Deep Zoom Composer in my next post.
On successful install and on starting up the screen looks like this
For generating a Composition or a Collection, you need to go through 3 steps:
Import stage involves adding as many images as you want.
Compose stage is where you work on the art board. The images can be placed anywhere depending on the requirement.
The last step involves exporting as a Collection or as a Composition.
Notice that Deep Zoom Composer allows you to choose between a Composition or a Collection. Also, it allows selection of Output type. Selecting "Export Images and Silverlight Project" generates a Visual Studio Project accompanying the Collection or Composition. We will deal with this in next blog entry. Selecting "Export Images" will generate the Output folder containing images along with the Composition or Collection.
There! Deep Zoom Image is now ready for use in a Silverlight project. If you had selected "Export Images", then you will have to code explicitly for MouseWheel movement. Check out Scott Hanselman's blog for code.
You can get the Deep Zoom Composer User guide from here.
Not got the idea yet? Check out http://memorabilia.hardrock.com/ for a live example and then come back.
Back? Now this is technology right! Wow!
My previous post was on Collection and Composition. Let's try and understand the tool that generates a collection or a composition.
Deep Zoom Composer has a tool named SparseImageTool.exe that is used to produce the final composition or collection. It can be accessed from command prompt as
C:\Program Files\Microsoft\Deep Zoom Composer\SparseImageTool.exe
Giving the above command generates the usage pattern for the tool
The basic usage pattern is SparseImageTool.exe <command> <SceneGraphFileName> [parameters]
where command could be CreateCollection or CreateDeepZoomImage
SceneGraphFileName is path for the SceneGraphFile.xml file
[parameters] refers to a list of other parameters that this application can take.
The SceneGraphFile.xml file has information about the images (width, height, position as x,y co-ordinates), aspect ratio and ZOrder for all images. This is generated by Deep Zoom Composer prior to calling SparseImageTool.exe.
Is it possible to access this tool programmatically? Well, let's try doing so. First, we need to create an XML file that looks similar to SceneGraphFile.xml that is generated by the Deep Zoom Composer.
The XML file looks like this:
<?xml version="1.0" encoding="utf-8"?>
Now, let's create a C# Console Application (I think you can try doing the same using VB as well...but am not sure).
static void Main(string args)
Process p = new Process();
p.StartInfo.FileName = "C:\\Program Files\\Microsoft\\Deep Zoom Composer\\SparseImageTool.exe";
p.StartInfo.Arguments = @"CreateCollection ""C:\\Users\\S.Preethi\\Desktop\\Folder\\test source.xml"" ""C:\\Users\\S.Preethi\\Desktop\\Folder\\result.sdc"" /XML";
p.StartInfo.CreateNoWindow = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
p.EnableRaisingEvents = true;
The folder contents before running the program is
Running the Console Application
Notice that the result folder has an XML file items.xml. The updated version allows generation of an XML file as against a Binary file in the previous version. We can now work with this XML file with ease. We can use this XML file to randomly position the images and do a lot of other things (Translation: More ideas coming soon).
The above operation can be done from Command Prompt as well.
SparseImageTool.exe CreateCollection "C:\Users\S.Preethi\Desktop\Folder\test source.xml" "C:\Users\S.Preethi\Desktop\Folder\result.sdc" /XML
Note: The extension .sdc has to be given correctly. Otherwise, the tool doesn't generate a collection.