digital libraries,
web preservation,
books,
archives.

Serve deepzoom images from a zip archive with openseadragon

2014-11-23 tags: deepzoom openseadragon vips golang digital libraries iiif

vips is a fast image processing system. Version higher than 7.40 can generate static tiles of big images in deepzoom format, saving them directly into a zip archive.

Simple as: $ vips dzsave big.jpg image.zip
(note: if you compile vips, verify to have libgsf1-dev installed)

A zip archive is more convenient than having thousand of small image files sparsed into a filesystem, so i was thinking a simple way to serve it with openseadragon directly from zip, without extracting.
In my desire to learn better Go, i've built this deepzoom-osd-server, a static web application that embeds openseadragon.

Compile:

install gom package manager

$ go get github.com/mattn/gom

clone and compile

$ git clone https://github.com/atomotic/deepzoom-osd-server.git
$ cd deepzoom-osd-server
$ make

The Makefile will download the latest binary of openseadragon, then bundle all dependencies into _vendor, then build the binary embedding all static assets (with nrsc)

Run

$ ./deepzoom-osd-server
-- missing dzi directory, creating.
-- running on http://127.0.0.1:8080

Now you can generate some deepzoom images and put them into the dzi directory just created.

The server will expose:

  • a /dzi endpoint to explore the content of the zip archive

    http://localhost:8080/dzi/{ZIPPED-DZI}.zip/{ZIPPED-DZI}.dzi
    
  • a /view endpoint with openseadragon

    http://localhost:8080/view/{ZIPPED-DZI}
    

This is an experiment, I'm not sure if is a sane idea to use for real things, i should stress the application (with ab or vegeta) and monitor its memory consumption.

Anyhow, if you are curating a digital library today and you need to publish big high quality images, absolutely you should look at IIIF specs, and use a more suitable server like IIPImage or Loris.