Prerequisites
This project uses the open source MTASC compiler to compile Actionscript 2 files to SWF format. Download and install from http://www.mtasc.org/ .
The image tiler software is written in python 2.4 or later. If you system does not include a python interpreter, go to http://www.python.org/ to obtain one.
The software also requires the Python Image Library, available from this url: http://www.pythonware.com/products/pil/
If you use OS X you will have to build the jpg and png libraries. I recommend using darwinports to build these, see http://darwinports.com/ for details.
Using the Tiler
The tiler is a python program that reads a high-resolution image file and generates the tiles needed to display the image in a zooming viewer. The software may be run from the command line or integrated into other software packages so that it can be invoked automatically as needed. (We typically run the tiler within a plone instance that automatically processes images when they are uploaded.)
Right now the tiler uses a lot of memory - loading all of the image data. For very large images you may need to use a setup that gives you a large memory space.
Using the Viewer
Place the compiled viewer viewer.swf in the folder with the HTML page or at some other known location. The viewer is embedded in a web page with the following HTML:
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"
width="100%" height="95%"
align="left">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="viewer.swf?image=[image-url]" />
<param name="quality" value="high" />
<param name="scale" value="noscale" />
<param name="salign" value="lt" />
<param name="bgcolor" value="#ffffff" />
<embed src="viewer.swf?image=[image-url]" quality="high"
scale="noscale" salign="lt" bgcolor="#ffffff" width="100%"
height="95%" align="left" allowscriptaccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
Replace [image-url] with the URL of the image folder created by the tiling program. Note that you may also have to add a crossdomain.xml to your server to satisfy flash's security mechanism. See this Adobe tech note for details.
Building the Viewer
The 'flash' directory includes a shell script build-viewer.sh to build the product. Change this file to use your installation directories. Here is mine:
#!/bin/bash
mtasc -version 8 -strict -swf viewer.swf -trace ppad.testing.Logger.log\
-main -cp /Users/jonathan/OpenSource/viewer/flash\
-cp /Users/jonathan/Applications/mtasc-1.12-osx/std\
ppad/image_viewer/ImageViewer
The options and arguments are:
| -version 8 | # Produce a version 8 SWF file |
| -strict | # Use strict type checking |
| -swf viewer.swf | # Name of output file |
| -trace ppad.testing.Logger.log | # A method to handle trace messages |
| -cp <path> | # Classpath to search, include both standard # libraries and viewer classes. |
| ppad/image_viewer/ImageViewer | # Name of main class |
