djiiif¶
djiiif makes it easy to expose your Django images through the
IIIF (International Image Interoperability Framework) family
of APIs. It extends Django’s ImageField so that, by defining one or more named
profiles, every image field gains ready-made IIIF URLs — and, optionally,
spec-compliant info.json, Presentation manifests, collections, activity
streams, annotations, and search, served straight from Django.
from djiiif import IIIFField
class Photo(models.Model):
image = IIIFField(upload_to="uploads/")
IIIF_HOST = "https://images.example.org/"
IIIF_PROFILES = {
"thumbnail": {"host": IIIF_HOST, "region": "full", "size": "150,",
"rotation": "0", "quality": "default", "format": "jpg"},
}
>>> photo.image.iiif.thumbnail
'https://images.example.org/uploads%2Fsunset.jpg/full/150,/0/default.jpg'
That’s the whole idea: your image server does the pixel work; djiiif builds the correct IIIF URLs and documents for it.
What djiiif gives you¶
Profile URLs — one IIIF Image API URL per named profile, as attributes on
.iiif(Profiles).Documents — build a spec-valid
info.jsonand a Presentation 3.0manifestfrom an image’s own dimensions (Info and manifest documents).Drop-in views — serve
info.json, manifests, and collections from Django with the correct content type and CORS (Serving IIIF documents from Django).Share links — Content State deep links that open an image, zoomed to a region, in a viewer (Share links (Content State)).
Richer manifests — descriptive metadata, multi-image objects, and collections (Richer manifests & collections).
Harvestable streams — a Change Discovery activity stream so aggregators can find what changed (Harvestable streams (Change Discovery)).
Annotations & search — serve transcriptions/OCR and search within an object (Annotations & search).
Authorization — advertise IIIF Authorization Flow 2.0 services (Authorization (Auth Flow 2.0)).
DRF & templates — a serializer field (Django REST Framework) and a template tag (Profiles).
Every feature beyond the core profile URLs is opt-in and backwards-compatible — nothing changes in your output until you configure it.
Where djiiif fits¶
djiiif does not process or serve image pixels. You pair it with a real IIIF image server — iiiris is the recommended one (IIIF Image API 3.0 + Authorization Flow 2.0), though any IIIF-compliant server or cloud IIIF service works. djiiif registers your source images with Django and produces the IIIF URLs and JSON documents that point at that server — plus, if you want, the Presentation, Discovery, Annotation, and Search documents the image server itself doesn’t provide.
Getting started
Guides
Reference