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

ddzzcc__oouutt011pp//6uu/tt._0000xf____mi0001ll....ejjjjspppp/gggg####TMhHTeeietgnaohsdnealsotytfatltiehlvoeeulsaatndlsevoeflt0iles

Implementation Challenges and Solutions

Challenge 1: XML Metadata Namespace Differences

Deep Zoom has multiple versions with different XML namespaces:

  • http://schemas.microsoft.com/deepzoom/2008
  • http://schemas.microsoft.com/deepzoom/2009

Solution: Implement a flexible XML parser supporting multiple namespaces

deffr#n]fwhreoaoieetoTmrditctretguhys'''niihhr_=p{{Ssmftnxmahhia=mEucttzigi=clTlettenembio_.tspp'_arninifi::negetnfnrp=/alea(tifol/me_ki(gome[ssememi(sccslamxtnhhp=egamraeeameglimmmcr_e_neaaeoie_ugssssosler(p..:tellramm.nme)eciifo.m:seccita.psrrntaooodNttnss(ortsoo'nireff.ebi.tt/:[bc../'[occ'W'nooiHtmm+dee//tinddnhgtees'h)ee)]tpp)'zz]oo)oomm//22000089}}SSiizzee'',,

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

deff"fri"oen"rtdDu_eluteraterrxncevlyctce:eNutl=ripcoaeftonltifs:ne_hn"prtme{oeriarbnsenxaaasptu_cnseoueltgenreue_=snva(ueel2rr.ll0lese(m,}qtvba{uaeax-letlsi1esuem,vts_ues_um-l.cr1}holl)/ed,e:0aev_dfe0(=ol.u=r{rmtfl2aho,0tar0_tmt:eaixetmtx_e)ieo:sxuttts}=""1"0")

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

defdsdwroeoiewswttnsnhulilf}wroooTuinanahttddruhd_=eereffotdaexotowir_dserqrnletPcdleqio=ucmfriposuloto(uefba(eel{olttsadtssEr,ouurreitx.trled.dls=esraetsou_e.cuoluwptsS[ubw=i=lndi_e]tmlntlallsoiief:oteisrtcnnauaessi((o(std(tomdltf_ue1,nao,iucrd)(xwltoe_b)_nreum.tawlosrprisoow_elelera,lsese_kdi)tusue_fs)el.rrtotdtalsira((p,=lmsf)p1eauel0,tptne)_budvbear(eaaxrerlsst:se,e,)se_:ufxusloeretrcls)mu,satitolo_rene:v)xe:tl),(:col,row)

Challenge 4: Handling Tile Overlap

Deep Zoom tiles have overlap (overlapping areas) for seamless display.

Solution: Coordinate calculation considering overlap

defrfeocronc#xycsoatlP==nr,lvuacracrcoostoelw._wmpi,eamnsatt((tgitteelcii((eolltt_oeeiiir__llmdsseegiii_snzzi,iaeemntgte--,itsli(elcvvx_eoee,ssnrri:sllyziaa)edpp),e))rivnegrlavpe)r:lap

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

defs#pi#iitanmmmivFgaCpgfei_goo_f_rfenrafoibctbsi.vtriumioiitlserltggmlgeartaep_tpetsvtiy.uair=ia=efitrfe(fv(tf=m_rfs2feopofwpa=s5(uninrayTi6iatgBlpit,ro,msp_ie.thunaufgae,e=2gPtiTr(,'5eN_lIrd6,GpeFae)a,Fyfo(t(lunhfuiato.osmtprriaeufemng'tipage,_llt)pea=tac'i##tsePf#hi(NfET)z'GfnCi:e.'iaolt,lbmilielpnifcergm'olei,miBstpbisarrgit.eaToipsrInonsyFng_F)'l)evel=6)

Implementation Results

Processing Performance

Image SizeTile CountDownload TimeFinal File Size
62533 x 2973428,899Approx. 12 min3.7GB (TIFF)
62588 x 2980029,146Approx. 12 min3.4GB (TIFF)
7760 x 103281,271Approx. 2 min72MB (TIFF)

Parallel Processing Effectiveness

  • Parallelism: 10 threads
  • Average download speed: Approx. 40 tiles/sec
  • Efficient use of network bandwidth

Technology Stack

#ifiiffmrmmrrMpoppooaomoommirrrntPttctIoqlrLntndieuicmbqimfurumpfriaepyfrmrsoiepitralnoestsetrs.tInfmputatqgudermesi####m#pHIABoPTmrirrTargtoPgaTgeyITrcFheopoFrsmrpesmoesaucrudbneapPaistporcsiooaiorltnntEigsxoencutor

Code Structure

dboawtncffdrslheioeao_tnwcvadcdnoedoh_ln__w_aosbdnxcatielmtdrgeolu_utpa_atcizdilitfo_n_l_fodfmei(meoa(m).e(x)app)_gyzleoe(ov)me.lp(y)#######XLTIBSBMeimiiaLvlagnteegTgcpleIlhadFeraorFpsuweiritnssmonoltaacg-oovgedariesedansttgpieirncoogtncieosnsing

Optimization Points

1. Session Reuse

s#reesRssepiuoosnnese=HT=rTePsqeucseossnitnosen.c.Stgeiesotsn(isuornwl(i))thinthesamesession

2. Error Handling

terxyc:erippreftresitprEnuoerxtrnsec(nsptefeoup"NnrtFo=snianeoies.Inlesmestaadsagsitetou.eonso:._pdgceoeonwtd(n(eBluyor=tal=ed,s2Itt0Oii0(lm:reee:osup{toe=n}3s"0e)).content))

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:

  1. Handling XML namespace differences
  2. Auto-detection of actual maximum levels
  3. Parallel download of large numbers of tiles
  4. Image restoration considering overlap
  5. 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.