Published

January 8, 2025

Generating IIIF manifests for a codex

When you model a codex, you document each page with an image. If the images are available from a server supporting the image serving protocol of the IIIF (International Image Interoperability Framework), you can easily share a catalog of the images as a IIIF Presentation Manifest presenting the sequence of the manuscript’s pages in order. In this tutorial, we’ll see how to use the iiifmanifest function to create a IIIF manifest for a codex, then serve the manifest from a platform like github to use it from anyone’s IIIF application.

To learn more

Prerequisites

We need:

  1. the data from the codex model
  2. the IIIF image service where the images are available
  3. information for configuring the Manifest.

The codex data

We’ll read the sample model of a codex from a file in this project’s github repository. See this tutorial for more details.

using CitablePhysicalText, CitableBase
f = joinpath(repo, "test", "assets", "burney86-sample.cex")
ms = fromcex(f, Codex, FileReader)[1]

The IIIF image service

We’ll use the IIIFservice type from the CitableImage package: see the package documentation for more details.

using CitableImage
imgsvc_baseurl = "http://www.homermultitext.org/iipsrv"
imgsvc_root = "/project/homer/pyramidal/deepzoom"
imgsvc = IIIFservice(imgsvc_baseurl, imgsvc_root)
IIIFservice("http://www.homermultitext.org/iipsrv", "/project/homer/pyramidal/deepzoom")

Configuring the manifest

Every manifest must have a unique

manifesturl = "https://raw.githubusercontent.com/cite-architecture/CitablePhysicalText.jl/refs/heads/main/test/assets/burney86samplemanifest.json"
conf = iiifconfig(manifesturl)
Configuration for IIIF manifest with ID https://raw.githubusercontent.com/cite-architecture/CitablePhysicalText.jl/refs/heads/main/test/assets/burney86samplemanifest.json
Manually conifguring IDs

You can use the IIIFConfig object to manually configure many values in the IIIF Presentation Manifest. The manifest identifies a series of Canvas objects, each containing an AnnotationPage, which in turn contains an Annotation to paint the containing Canvas. You can configure collection names for each of these types of objects. See details in the API documentation.

Generating the manifest

With these parameters defined, we can get the JSON text of a manifest for our codex:

manifestjson = iiifmanifest(ms, conf, imgsvc)
Warning

When the manifest is composed, the image for each page is tested by querying the IIIF server to get the image’s dimensions. For a long manuscript or book, this can take some time, especially if the connection to the server is not fast.

You can, however, be sure that every entry in the manifest describes a legitimate image on the configured server.

Publishing and using the manifest

Now all we need to do is serve the text on the internet, preferably with support for COR. Github can do this for us: we’ll write the output to the same directory where we kept our source data for the codex.

outfile = joinpath(repo, "test", "assets", "burney86samplemanifest.json")
open(outfile,"w") do io
    write(io, manifestjson)
end

We’ve pushed this to our repository so that it is available at this URL:

https://raw.githubusercontent.com/cite-architecture/CitablePhysicalText.jl/refs/heads/main/test/assets/burney86samplemanifest.json

Use that with any IIIF viewer (like these).

Here’s our manifest displayed in the Tify viewer: