Introduction
Deep Zoom technology is used to smoothly zoom and display high-resolution images on websites. There are cases where you need to restore the original high-resolution image from tiled image data generated by tools such as Microsoft Deep Zoom Composer.
This article explains the technology for restoring original high-resolution TIFF images from image data published in Deep Zoom format.
How Deep Zoom Images Work
Tile Structure
Deep Zoom images divide a single large image into multiple small tile images and store them in a pyramid structure:
- Level 0: Lowest resolution (usually 1 tile)
- Level N: Highest resolution (equivalent to the original image resolution)
- Resolution doubles at each level
File Structure
Implementation Challenges and Solutions
Challenge 1: XML Metadata Namespace Differences
Deep Zoom has multiple versions with different XML namespaces:
http://schemas.microsoft.com/deepzoom/2008http://schemas.microsoft.com/deepzoom/2009
Solution: Implement a flexible XML parser supporting multiple namespaces
Challenge 2: Auto-Detection of Maximum Level
The maximum level stated in the XML may differ from the levels actually available on the server.
Solution: Send HEAD requests to verify existence
Challenge 3: Efficient Download of Large Numbers of Tiles
High-resolution images require downloading tens of thousands of tiles (e.g., 29,146 tiles).
Solution: Parallel download using ThreadPoolExecutor
Challenge 4: Handling Tile Overlap
Deep Zoom tiles have overlap (overlapping areas) for seamless display.
Solution: Coordinate calculation considering overlap
Challenge 5: Saving Large Images
Restored images can be several GB in size, potentially exceeding the standard TIFF 4GB limit.
Solution: Save in BigTIFF format
Implementation Results
Processing Performance
| Image Size | Tile Count | Download Time | Final File Size |
|---|---|---|---|
| 62533 x 29734 | 28,899 | Approx. 12 min | 3.7GB (TIFF) |
| 62588 x 29800 | 29,146 | Approx. 12 min | 3.4GB (TIFF) |
| 7760 x 10328 | 1,271 | Approx. 2 min | 72MB (TIFF) |
Parallel Processing Effectiveness
- Parallelism: 10 threads
- Average download speed: Approx. 40 tiles/sec
- Efficient use of network bandwidth
Technology Stack
Code Structure
Optimization Points
1. Session Reuse
2. Error Handling
3. Memory Efficiency
- Process tile by tile to minimize memory usage
- Create the large canvas only once
Use Cases
Digital Archives
- High-resolution image preservation of historical documents and artworks
- Complete restoration of map data
- Digital preservation of cultural assets
Data Migration
- Image data conversion during platform migration
- Complete image acquisition for backup purposes
- Image usage in offline environments
Summary
The restoration of Deep Zoom images involved the following technical challenges, which were successfully addressed:
- Handling XML namespace differences
- Auto-detection of actual maximum levels
- Parallel download of large numbers of tiles
- Image restoration considering overlap
- Large image storage in BigTIFF format
Using this method, ultra-high-resolution images of 60,000 x 30,000 pixels could be completely restored in approximately 12 minutes.
References
- Microsoft Deep Zoom Specification
- PIL/Pillow Documentation
- tifffile Library Documentation
- Python concurrent.futures
Note: The techniques described in this article should only be used on image data for which you have appropriate permissions. Please ensure compliance with copyright and licensing requirements.