Skip to content

Script for automatic image retrieval from IIIF manifests

License

Notifications You must be signed in to change notification settings

Segolene-Albouy/iiif-download

Repository files navigation

Download images from IIIF manifests

PyPI - Version PyPI - Python Version Test Status

This repository contains code to download images from IIIF manifests. It takes into account limitations and data specificities from various institutions.

pip install iiif-download

Basic usage

The configuration is stored in iiif_download/config.py and can be overriden by setting environment variables.

Inside a script

from iiif_download import IIIFManifest, config, Config

# Override the default configuration
config.max_size = 2500
config.img_dir = "custom/path/to/images"

manifest_url = "https://example.org/manifest"

# Use global config
manifest = IIIFManifest(manifest_url)

# or override the global config for a specific manifest
manifest = IIIFManifest(
    manifest_url,
    # surcharge any global attribute locally
    img_dir="path/to/dir",
    max_size=4000
)

# or define another config
manifest = IIIFManifest(manifest_url, config=Config(is_logged=False))

# Download images from a manifest inside img_dir/dir_name
manifest.download(save_dir="dir_name")

Command line

# override specific variables
export IIIF_IMG_DIR=custom/path/to/images
export IIIF_MAX_SIZE=4000
# or use .env
source .env

iiif-download https://example.org/manifest
iiif-download -f test-manifests.txt
iiif-download -d custom/path/to/images

Metadata extraction

from iiif_download import IIIFManifest

manifest = IIIFManifest("https://example.org/manifest")
manifest.load()
lic = manifest.license
author = manifest.get_meta("author")
images = manifest.get_images()

About

Script for automatic image retrieval from IIIF manifests

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages