IIIF implementation

Published: Dec 10, 2021 by Steve Baskauf

In connection with uploading files to Wikimedia Commons as part of our WikiProject Vanderbilt Fine Arts Gallery, I’ve been working on the details of uploading images to the Vanderbilt LibrariesCantaloupe International Image Interoperability Framework (IIIF) server and providing IIIF manifests to describe them.

This required working out a number of technical details. Making the images available to the server required uploading them to an AWS S3 bucket. This was done using the boto3 library of the AWS Python SDK as part of the Commonsbot script I use to upload images to Commons.

While doing the image upload, I also created a simple JSON IIIF manifest for each image, based on the pattern used by the National Gallery of Art with images they’ve uploaded to Commons. The manifests are served directly from another S3 bucket and are also generated and uploaded by Commonsbot.

With the image accessible from the IIIF server and the manifest in place, I could then create a link to the manifest in the Wikidata item for Public Domain works in the Fine Arts Gallery using the P6108 “IIIF Manifest” property. There is a user script that enables an embedded Mirador IIIF viewer when a Wikidata user adds the line

mw.loader.load( '//www.wikidata.org/w/index.php?title=User:Btwashburn/iiif-mirador.js&action=raw&ctype=text/javascript' );

to their common.js page. Once the user script is enabled, the viewer automatically displays the image for any item with a P6108 property, such as https://www.wikidata.org/wiki/Q103306985. This is cool because you can zoom into details on the image as shown above.

One issue that was difficult to work out was converting the high resolution TIFF images from the format produced by the imaging camera to the “tiled pyramidal” format required by the IIIF server to serve smaller versions or closeups of the image quickly. (For a good explanation of image pyramids, see the first part of this video.) After trying a bunch of different methods to script the conversion, I was finally successful using command line ImageMagick for Mac based on the examples in this post. I was able to script the conversion in Python using these statements:

import os
os.system('convert 1979.0342P.tif -define tiff:tile-geometry=256x256 -depth 8 ptif:1979.0342P_tiled.tif')

where 1979.0342P.tif is the name of the file to convert.

Share

Latest Posts

Uploading a thousand Gallery images to Commons
Uploading a thousand Gallery images to Commons

I recently finished work on CommonsTool, a Python script to upload artwork images to Wikimedia Commons. In addition to uploading the image files, it creates Structured Data on Commons claims to provide machine-readable metadata about the images and to link them to Wikidata items that describe the underlying artwork objects. It also uploads the images to the Vanderbilt Libraries’ International Image Interoperability Framework (IIIF) server and generates IIIF manifests to display those images in a IIIF viewer.

Making SPARQL queries to Wikidata using Python
Making SPARQL queries to Wikidata using Python

I recently solved several annoying problems that I’d been having when using SPARQL queries to acquire data from Wikidata. My success inspired me to write a comprehensive Python class that will reliably carry out every kind of SPARQL Query and Update, with defaults to easily make SELECT queries to Wikidata.

Birding in Puerto Rico
Birding in Puerto Rico

After recently making a trip to Puerto Rico that was primarily focused on bird watching, I decided to write a blog post to pass on some of what we learned. Much of the information that we got from books or the Internet was outdated or incorrect, so hopefully this post will help others to have an easier time finding good places to bird there.