Skip to main content

A python library that loads iiif images (IIIF Image Api Manifests) into a cv2 numpy array

Project description

iiif_image_load

A python library for loading iiif images (IIIF Image Api Manifests).

How to Install

To install, just run pip install iiif_image_load.

About

This library makes it possible to submit the URL to a IIIF Image API manifest (along with optional cropping parameters) and receive a standard OpenCV Numpy (3D BGR) array containing the image.

The downloading process will access image tiles in accordance with the IIIF Image server's specifications. This makes download of image at full resolution possible on all IIIF compliant image servers and will potentially speed up the download process (and relieve stress on the IIIF image server).

Usage

To acquire an image with this library, the following examples should suffice:

from iiif_image_load import iiif_image_from_url
import cv2

img = iiif_image_from_url('https://ids.lib.harvard.edu/ids/iiif/47174896')

cv2.imshow('Demo Paul Gauguin', img)
cv2.waitKey(0)
cv2.destroyAllWindows()

It is also possible to specify a crop box for the image:

from iiif_image_load import iiif_image_from_url
from matplotlib.pyplot import imshow

img = iiif_image_from_url('https://ids.lib.harvard.edu/ids/iiif/47174896', 10, 20, 500, 500)

imshow(img[...,::-1])

Project details


Download files

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

Source Distribution

iiif-image-load-0.4.2.tar.gz (4.8 kB view hashes)

Uploaded Source

Built Distribution

iiif_image_load-0.4.2-py3-none-any.whl (5.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page