Thursday, April 10, 2008

DeepZoom.Analyze

To help unravel the mysteries of how the Silverlight MultiScaleImage control works, I've created an analysis tool which displays each layer of the composite image individually.

Each level of a DeepZoom image consists of a sparse 2D array of separate JPEG images which are tiled together to create the composite image. Zooming in moves through the layers smoothly. Tiles are progressively downloaded as needed for display, and layers are blended using animation.

The lowest level is numbered zero. The highest level is equal to 1 + log2 of the largest image dimension. As you move from the highest level backwards, each level is 1/2 the width and 1/2 the height of the next level up the tree. This progression continues to layer zero which is a 1 x1 pixel image.

You can see the sparse nature of the array at level 12 of the image below. The tiles in the lower left corner are absent since they can be adequately represented by tiles at lower levels (lower zoom values).

image

Below is level 14 of the same image. Note the dimensions of 14,718 x 14,334 pixels, and that the level consumes 43MB. You can see this image in action at http://www.deepzoom.com/.

image

Usage: Open the info.xml file associated with the Deep Zoom image tree, and then use the scroll bar to select which level to view. Note that the file open operation runs on the UI thread, so there will be a short delay when opening huge image trees. The info box in the bottom right shows details such as dimensions and total kilobytes used at the selected level.

Clicking "Tile Presence" shows the whether the tile is used in the current level. In Silverlight 2.0 B1, the tile presence elements don't seem to be used consistently, and are missing entirely from some layers which do have image tile data. And the MeanSquareError and BitsPerPixel fields also seem to be currently unused.

image

Here's the download, an 10KB .zip file (I didn't realize WPF applications would be so tiny!)

  • Requirements: DotNet 3.5.
  • Download: DeepZoomAnalyze.zip (Last updated 2008.06.29 for Silverlight Beta 2 -
    Note: only compositions are presently working, collections fail silently.)

No comments: