Creating Deep Zoom Images from Image through C# code in Azure

In this quick post, I will show you the creation of deep zoom images from an Image in Azure BLOB. You may come with a requirement where you need to create deep zoom images using code. If you need deep zoom images for a Pivot Viewer you can very much create it using several tools available. However you may have to create deep zoom images using code in some scenario. I am going to share code snippet for the same.

  1. First you need to include the DeepZoomTools dll as a reference in your project.
     
  2. Add namespace

    Deep Zoom Images from image through C# code
     
  3. Next you need to create Container and set the basic properties as below,

    Deep Zoom Images from image through C# code
     
  4. Next create list of images you want to convert as deep zoom image. For purpose of this post, I am taking only one image. That image is in Azure Blob. So for that I am giving URL of the Image saved in azure Blob. You can choose image from local storage as well.

    Deep Zoom Images from image through C# code
     
  5. In the last step you need to create deep zoom images using the create method of CollectorCreator

    Deep Zoom Images from image through C# code

For reference, the full source code is as below,

protected void Button1_Click(object sender, EventArgs e)
{
 
    string directoryToSaveDeepZoomImages = "D:\\abc";

    CollectionCreator collectionCreator = new CollectionCreator();
    collectionCreator.TileSize = 256;
    collectionCreator.TileFormat = Microsoft.DeepZoomTools.ImageFormat.Png;
    collectionCreator.ImageQuality = 1.0;
    collectionCreator.TileOverlap = 0;

    List<Microsoft.DeepZoomTools.Image> images =
                new List<Microsoft.DeepZoomTools.Image>();
    images.Add(new Microsoft.DeepZoomTools.Image("azuerbloburlforimage"));         

    collectionCreator.Create(images, directoryToSaveDeepZoomImages);

}

In this way you can create deep zoom images. I hope this post was useful. Thanks for reading.

If you find my posts useful you may like to follow me on twitter http://twitter.com/debug_mode  or may like Facebook page of my blog http://www.facebook.com/DebugMode.Net  If you want to see post on a particular topic please do write on FB page or tweet me about that, I would love to help you.

Up Next
    Ebook Download
    View all
    Learn
    View all