JPEG2000 to Zoomify Shim – Creating JPEG tiles from JPEG2000 images

2 minute read

× This article was imported from this blog's previous content management system (WordPress), and may have errors in formatting and functionality. If you find these errors are a significant barrier to understanding the article, please let me know.

This is a textual representation of a lightning talk done on Feb 26th at Code4Lib 2008. When the video of the talk is up (thanks, Noel!) I'll link it here, too. The video is now available, and that article includes an update on progress since the this article was posted.

OhioLINK has a collection of JPEG2000 images as an access format that were generated for use in our DLXS-based content system. We are in the process of migrating those collections to DSpace and were looking for a mechanism to leverage the existing JPEG2000 files and not have to generate new derivatives. We are also considering the use of JPEG2000 as a preservation format, and would find it attractive to use the same image format for both access copies and preservation copies. We looked at Zoomify, but to perform its scaling function it generates JPEG tiles at several resolutions and storing those tiles can triple or quadruple disk space requirements. Or, one could use the 'enterprise' version of Zoomify and its proprietary PFF format or the equally proprietary MrSID format. We didn't want to be locked into either of these scenarios. Our solution is to create a web application that mimics the directory-of-JPEG-tiles solution, but to dynamically generate the tiles our of a JPEG2000 master.

The free version of Zoomify reads JPEG tiles out of a directory structure that looks like this:

/ImageProperties.xml Includes descriptive elements of the source image like height, width, and tile size. /TileGroup0/0-0-0.jpg The highest power-of-2 zoom out level that creates an image with dimensions less than 256x256 /TileGroup0/1-0-0.jpg The tile at the upper left corner at the first power-of-2 zoom level /TileGroup0/1-1-0.jpg The tile to the left of 1-0-0.jpg

The shim mimics that directory structure. It parses the URL of the request and dynamically creates the appropriate JPEG tile (or metadata file) out of the JPEG2000 image.

The Code

The JPEG2000 for Zoomify shim requires Java 1.5 or greater. It does not require a servlet engine; rather, it uses the Restlet library to perform as a stand-alone application. The OneJar library allows the Java classes and required dependencies to be bundled into a single JAR file. We're using the Kakadu Software JPEG2000 library to perform the on-the-fly decoding of JPEG2000 images. Kakadu is a commercial JPEG2000 codec, although inexpensive licenses are available for not-for-profit activity. We are using the Enterprise version of Zoomify, a Flash-based image viewer, although I believe the free version will work as well. (You'll need the Enterprise version to be able to modify and adapt the appearance of the Zoomify applet.) The same techniques can also be used for other Flash applets and probably even JavaScript-based viewers (a la Google Maps).

The source code is available from the OhioLINK DRC source code repository (Subversion access). We plan to integrate it into DSpace 1.5 as part of the Ohio Digital Resource Commons, and I may create a Fedora disseminator to serve up the tiles as well.

Thanks go out to Keith Gilbertson and John Davison on the OhioLINK staff for their help in making this work as well as Stu Hicks and François d'Erneville for being a sounding board for these ideas.

The text was modified to update a link from http://code4lib/conference/2008 to on January 28th, 2011.

The text was modified to update a link from to on January 28th, 2011.