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 Libraries’ Cantaloupe 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.