API Docs

IIIF API for Invenio.

class invenio_iiif.ext.InvenioIIIF(app=None)[source]

Invenio-IIIF extension.

Extension initialization.

init_app(app)[source]

Flask application initialization.

init_config(app)[source]

Initialize configuration.

class invenio_iiif.ext.InvenioIIIFAPI(app=None)[source]

Invenio-IIIF extension.

Extension initialization.

init_app(app)[source]

Flask application initialization.

Handlers

Handler functions for Flask-IIIF to open image and protect API.

invenio_iiif.handlers.image_opener(key)[source]

Handler to locate file based on key.

Note

If the file is a PDF then only the first page will be returned as an image.

Parameters:key – A key encoded in the format “<bucket>:<version>:<object_key>”.
Returns:A file-like object.
invenio_iiif.handlers.protect_api(uuid=None, **kwargs)[source]

Retrieve object and check permissions.

Retrieve ObjectVersion of image being requested and check permission using the Invenio-Files-REST permission factory.

Previewer

IIIF image previewer.

invenio_iiif.previewer.blueprint = <flask.blueprints.Blueprint object>

Blueprint to allow loading of templates.

invenio_iiif.previewer.can_preview(file)[source]

Determine if the given file can be previewed by its extension.

Parameters:file – The file to be previewed.
Returns:Boolean
invenio_iiif.previewer.preview(file)[source]

Render appropriate template with embed flag.

Note

Any non .png image is treated as .jpg

Parameters:file – The file to be previewed.
Returns:Template with the preview of the provided file.

Tasks

Background tasks to prepare cache with thumbnails.

Utils

Utilities for IIIF.

invenio_iiif.utils.iiif_image_key(obj)[source]

Generate a unique IIIF image key, using the images DB location.

Parameters:obj – File object instance.
Returns:Image key ‘u’(str)
invenio_iiif.utils.ui_iiif_image_url(obj, version='v2', region='full', size='full', rotation=0, quality='default', image_format='png')[source]

Generate IIIF image URL from the UI application.

Parameters:obj – File object instance.
Returns:URL to retrieve the processed image from.