August in Helsinki Rephotography

This month in Helsinki Rephotography we have worked on implementing IIIF using IIIPImage to Ajapaik. IIIF stands for the International Image Interoperability Framework, and it is a protocol for standardizing image retrieval. Using IIIF it is easy for users to manipulate images, like modifying size, scale, region of interest, rotation, quality, and format. IIIF also allows for easy implementation of image annotations, and with it users can comment, transcribe and draw on images.

The IIIF protocol has two parts, the image API, and the presentation API. The image API delivers images in a way that easily specifies the characteristics of the image, such as region, size, rotation, and quality. The presentation API on the other hand provides the information necessary to drive a compelling viewer experience.

IIPImage is a high-performance image server that can be used to stream high resolution images. It uses IIIF and the Fast CGI protocol in combination with a front-end web server (nginx in Ajapaik’s case). IIPImage can use images that are either in the TIFF format, or the JPEG2000 format. It also comes with an image converting tool called vips than can be used to convert images to the TIFF format.

During the month I have made a Python script that is used with the uWSGI server to download images from Wikimedia, convert them to the TIFF format and then display them over IIIF. uWSGI is a Web Server Gateway Interface server implementation that can be used in conjunction with a web server to forward requests to an external program.

The idea is to get this script to execute whenever a 404 Not Found error happens at the IIPImage server. It will parse the filename from the request and find out if the image can be found on Wikimedia Commons. If it can, it will download and convert the image to TIFF using vips. Lastly it will redirect the user to the IIPImage server that will serve the image using the IIIF protocol.

I did this by launching uWSGI with the Python script and a socket file as parameters. I then added a new location to the nginx site configuration that specifies that the requests to this location should be forwarded to the uWSGI server. This worked when the user directly accessed the location but didn’t when they were forwarded to it from a 404 error, since in that case only the request URL got forwarded to uWSGI instead of the full parameters.

To fix this we had to modify the script to parse the filename from the full URL. This was easy with Python’s urllib. Now we are in the process of implementing the presentation API of IIIF. During the Wikimania Hackathon we also added a link to IIIF to the user interface of Ajapaik.

-Siru, intern


Sähköpostiosoitettasi ei julkaista. Pakolliset kentät on merkitty *