Exercise 8: IIIF & ML
IIIF & ML
This exercise covers IIIF (International Image Interoperability Framework) from the ground up — finding and comparing resources, manipulating Image API URIs, reading a manifest as JSON-LD, and building a collection — before moving on to Machine Learning applications. Work alone or in pairs.
A. Finding and Comparing IIIF Resources
Open the Mirador demo viewer at https://projectmirador.org/demo/, close the default examples, and open at least two versions of the Gutenberg Bible by pasting these manifest URLs:
Institution Manifest URL Bayerische Staatsbibliothek (BSB) https://api.digitale-sammlungen.de/iiif/presentation/v2/bsb00004647/manifestBibliothèque Mazarine https://mazarinum.bibliotheque-mazarine.fr/iiif/1703/manifestFind a third Gutenberg Bible (or fragment) on one of the following portals and open its manifest in Mirador:
- Digital Bodleian (University of Oxford): https://digital.bodleian.ox.ac.uk/
- Gallica (BnF): https://gallica.bnf.fr/
- DigiVatlib (Vatican): https://digi.vatlib.it/
- To open a manifest in Mirador, click the + (Add resource) button and paste the manifest URL.
- On Gallica, search for “Gutenberg” and look for the IIIF logo on the item page or open Mirador to find it. Alternatively, you can use the detektIIIF browser extension to surface manifests automatically as you browse. This plug-in works for Firefox and Google Chrome.
B. IIIF Image API — URI Manipulation
The images below are served from two different institutions using the same IIIF Image API standard. Notice the structural similarity of the URLs despite the different servers and collections (both return 600px wide images via the 600, size parameter):
- https://api.digitale-sammlungen.de/iiif/image/v2/bsb00004647_00005/full/600,/0/default.jpg
- https://e-codices.ch/loris/fmb/fmb-cb-0600a/fmb-cb-0600a_004.jp2/full/600,/0/default.jpg
…/bsb00004647_00005/full/600,/0/default.jpg
…/fmb-cb-0600a/fmb-cb-0600a_004.jp2/full/600,/0/default.jpg
The URI follows this pattern: {server}/{identifier}/{region}/{size}/{rotation}/{quality}.{format}
The key differences between the two current versions:
| Parameter | IIIF Image API 2.1 | IIIF Image API 3.0 |
|---|---|---|
| Full image (no downscaling) | full |
max |
| Upscaling beyond native size | not supported | ^w, or ^!w,h |
| Quality: server default | native (deprecated) → default |
default |
@context |
…/image/2/context.json |
…/image/3/context.json |
In practice, many servers still accept full for backwards compatibility, but max is the correct term in 3.0. The region, rotation, quality, and format parameters are otherwise identical between versions.
- Start from this Image API URI for a BSB page and open it in your browser:
https://api.digitale-sammlungen.de/iiif/image/v2/bsb00004647_00005/full/full/0/default.jpg
Use the IIIF Image Inspector at https://iiifimage.link/ to manipulate the URI parameters. Try to produce at least two of the following variations:
- A cropped region (e.g. the top-left quarter of the page)
- A specific pixel width (e.g.
200,) - A 90° or 180° rotation
- A greyscale or bitonal rendering
- The BSB server only supports Image API 2. To explore API 3, use this image from the PTT Archive instead — check its
info.jsonfirst:
https://iiif.ptt-archiv.ch/iiif/3/P-38-2-1851-08.jp2/info.json
Construct a valid IIIF Image API 3 URI that returns the full image at maximum size.
- In the Inspector, change one parameter at a time and observe how the image updates — this is the easiest way to build intuition.
- The
regionparameter uses pixel coordinates:x,y,w,h. To crop the top-left quarter of an image that is 2000 × 2800 px, you would use0,0,1000,1400. - For step 5: the base URI structure is
{base}/{region}/{size}/{rotation}/{quality}.{format}. In API 3,full(meaning “as large as possible”) was renamed tomax. So the URI becomes:https://iiif.ptt-archiv.ch/iiif/3/P-38-2-1851-08.jp2/full/max/0/default.jpg - Additional tools: IIIF Cropping Tool (2.1 only, focused on the
regionparameter).
C. Exploring a Manifest as JSON-LD
- Open the Fragmentarium manifest in your browser:
https://fragmentarium.ms/metadata/iiif/F-65po/manifest.json
The Fragmentarium manifest uses Presentation API 2.1. Many newer institutions publish in 3.0. The main structural differences:
| Aspect | IIIF Presentation API 2.1 | IIIF Presentation API 3.0 |
|---|---|---|
| JSON-LD keywords | @id, @type |
id, type |
| Type values | sc:Manifest, sc:Canvas |
Manifest, Canvas |
| Image path | sequences[0] → canvases → images → resource → @id |
items → items (AnnotationPage) → items (Annotation) → body → id |
| Descriptive text | label (string), description |
label (language map {"en": ["…"]}), summary |
| Rights / attribution | license, attribution |
rights, requiredStatement |
@context |
…/presentation/2/context.json |
…/presentation/3/context.json |
Navigate the v2.1 JSON structure to find:
- The manifest
label - The image URI at:
sequences→canvases→images→resource→@id - The
info.jsonbase URI at:resource→service→@id
- The manifest
Open it (normally the URL redirects to the
/info.json; if not, you need to append it). What information does it provide about the image, such as dimensions, available sizes and API compliance level?
- If the raw JSON is hard to read in a browser, paste the URL into https://jsonhero.io/ for an interactive tree view.
- In the v2.1 manifest,
sequences[0].canvases[0].images[0].resource["@id"]gives you the full Image API URI (ending in/full/full/0/default.jpg). Paste it into your browser to display the image directly. - The
service["@id"]insideresourceis the Image API base URI and should redirect to the/info.json.
D. Building a IIIF Collection on Biblissima
Go to https://iiif.biblissima.fr/collections/ and create a new IIIF Collection by adding a few digital objects to your basket 🛒.
View your newly created collection in Mirador.
Open the raw JSON of your collection. How does a collection reference its member manifests?
- On Biblissima, you do not need an account — you can build and share a collection directly. Copy the collection URL once you have added your items.
- In the collection JSON, the top-level type is
sc:Collection(Presentation API 2) orCollection(Presentation API 3). Member manifests appear in themembersarray (v2) oritemsarray (v3). - A IIIF Collection is itself a valid IIIF resource: you can nest collections inside other collections, enabling hierarchical structures for large corpora.
E. Creative Reuse: IIIF Collage Demo
The IIIF Collage Demo assembles images from IIIF manifests into generative visual collages.
Generate a collage by clicking on the dice icon 🎲. This will randomly select a manifest and look for fragments.
Once you see the fragments, you can start your collage. Save it as a PNG or view it as a new manifest.
- If the Space is slow to respond, it may be waking up from idle — wait a moment and retry.
- The collage is built from the canvases in the manifest: the more pages, the richer the result.
F. ML-Powered Analysis: Illustration Detector
The IIIF Illustration Detector uses a small object-detection model to localise illustrations, miniatures, and decorations within digitised pages.
Open the demo, select a sample manifest from the drop-down list and load it.
Classify with a low (<50%) and high confidence threshold (>90%) and export the annotations. Have a look at the JSON-LD file.
- The model outputs bounding boxes with confidence scores. Low-confidence detections may indicate ambiguous content (decorative initials, ruled borders).
- Dense text columns or marginal annotations can sometimes trigger detections — think about why a model trained on visual regions might confuse them with illustrations.
- Consider the downstream value: how could automated illustration detection at scale help cataloguers, researchers, or discovery interfaces?
G. Reflection
What advantages do the IIIF specifications offer when building ML pipelines across multiple cultural heritage institutions?
How might the outputs of a tool like the Illustration Detector be published as structured open data alongside the source IIIF manifest?
- Q15: Think about interoperability — IIIF means a pipeline written once can consume images from the BSB, the BnF, or e-codices without institution-specific code. What does that enable at scale?
- Q16: Detected regions can be encoded as W3C Web Annotations and attached to IIIF canvases via the
annotationsproperty. Have a look at the IIIF Cookbook for annotation examples.
Bonus: Run Your Own Local IIIF Server
tiny-iiif is a lightweight, Docker-based tool for hosting your own IIIF Image API server and generating IIIF Presentation API 3.0 manifests automatically from uploaded images.
Get the repository — clone it or download the ZIP:
Configure — copy the example environment file:
Default credentials:
tiny / tiny. IIPImage is used by default; Cantaloupe is available viaCOMPOSE_PROFILE=cantaloupein.env.Start the server:
Open the admin interface at http://localhost/tiny, log in, and upload a few images via drag-and-drop — they are automatically converted to pyramidal TIFFs. Create a folder, add your images, and inspect the auto-generated manifest.
Open the manifest in Mirador (https://projectmirador.org/demo/) or Universal Viewer (https://www.universalviewer.dev/). As an extension: can you run the Illustration Detector (Part F) on the manifest your local server just generated?
- You will need Docker Desktop (macOS/Windows) or Docker Engine + Compose (Linux) installed and running before you start.
- To stop the server cleanly:
docker compose down - The local manifest URL will follow the pattern
http://localhost/manifests/...— paste it directly into any IIIF clients.
Additional Resources
- IIIF Image API 2.1 URI syntax: https://iiif.io/api/image/2.1/#uri-syntax
- IIIF Image API 3.0 URI syntax: https://iiif.io/api/image/3.0/#2-uri-syntax
- IIIF Presentation API 2.1: https://iiif.io/api/presentation/2.1/
- IIIF Presentation API 3.0: https://iiif.io/api/presentation/3/
- Guides to finding IIIF resources: https://iiif.io/guides/finding_resources/
- IIIF Cookbook: https://iiif.io/api/cookbook/
- IIIF Community groups: https://iiif.io/community/groups/
- Hugging Face GLAM ML models: https://huggingface.co/spaces/small-models-for-glam
- tiny-iiif on GitHub: https://github.com/rsimon/tiny-iiif