Batch Process Deepzoom / MS Sea Dragon / OpenSeadragon image Tiles with Bash

Zoomable images are awesome.

The people at OpenSeadragon have nailed a javascript implementation of zoomable image tiles. It feels seamless, looks great and is customizable. I got the chance to play with SeaDragon when we created One-Met-Many-Worlds. The project was created in part to begin the process of internationalizing our website.  For the team working on the project, there were several challenges, because of OpenSeadragon, zoomable images was not one of them.

The process is pretty dead simple.

To start you’ll need a few things, Homebrew and vips.

Homebrew is a package manager for Mac.

vips is a command line utility that generates tiled images from a tif file.

I installed Homebrew from the website.

Installed vips and it’s dependencies using terminal on a Mac with the following command.

$ brew install vips –with-cfitsio –with-fftw –with-imagemagick –with-libexif –with-liboil –with-libtiff –with-little-cms –with-openexr –with-openslide –with-pango

And ran the following command to test tile creation.

$ vips dzsave filename.tif mydz

One down but with over 600 additional tifs to process, I decided it was time to use bash to remove myself from the process and a script was born.


It recursively reads a directory structure looking for .tif files. Any tif is tiled and saved into a folder called mydz_files inside the tifs folder. Accompanying this is a small file, mydz.dzi. The xml in this file tells deepzoom the height and width of the image its rendering.

Here’s a link to one of the works of art, check out the zoom.

To view the zoom itself, use this link.

Take a look, use it, fix it, enhance it and/or drop me a comment.

Leave a Reply

Your email address will not be published. Required fields are marked *