Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

An implementation of the IIIF Image API 2.0 Specification

Project Description

An implementation of the IIIF Image API 2.0 Specification


$ pip3 install iiif2


The iiif2 library includes an image processing component called IIIF, responsible for implementing the iiif image processing pipeline, and a Parse utility capable of extracting iiif parameters and their data from uris.

from iiif2 import IIIF
from iiif2.web import Parse

You can combine the IIIF and Parse objects to create iiif 2.0 image tiles using only:

  • a iiif image 2.0 uri and
  • a resolved image filepath

An image path may be provided in one of two ways. First, it can be manually specified as a string:

from iiif2 import IIIF, web

url = ''

# a web server can return a rendered tile directly
# without ever saving tile to disk. Works on read-only fs:
tile = IIIF.render('images/file.jpg', *web.Parse(url))

# if we want, we can save tile (e.g. for caching)'cache/%s' % web.urihash(url))

Example Web Service

An entire IIIF Web Service written in Flask in ~30 lines of code is provided in the examples/ folder.

import os.path
from flask import Flask, request, jsonify, send_file
from iiif2 import IIIF, web

PATH = os.path.dirname(os.path.realpath(__file__))
app = Flask(__name__)

def info(identifier):
      return jsonify(, identifier))

def iiif(**kwargs):
    params = web.Parse.params(**kwargs)
    path = resolve(params.get('identifier'))
    with IIIF.render(path, **params) as tile:
        return send_file(tile, mimetype=tile.mime)

def resolve(identifier):
    """Resolves a iiif identifier to the resource's path on disk.
    This method is specific to this server's architecture.
    return os.path.join(PATH, 'images', '%s.jpg' % identifier)

if __name__ == "__main__":

Release History

This version
History Node


History Node


History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(9.6 kB) Copy SHA256 Hash SHA256
Wheel 2.7 Sep 4, 2015
(6.8 kB) Copy SHA256 Hash SHA256
Source None Sep 4, 2015

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting