Metadata-Version: 2.4
Name: iiif-download
Version: 0.1.17
Summary: A Python package to download images from IIIF manifests
Author-email: Segolene-Albouy <segolene.albouy@gmail.com>
Project-URL: Homepage, https://github.com/Segolene-Albouy/iiif-download
Project-URL: Documentation, https://github.com/Segolene-Albouy/iiif-download#readme
Project-URL: Repository, https://github.com/Segolene-Albouy/iiif-download
Project-URL: Issues, https://github.com/Segolene-Albouy/iiif-download/issues
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Pillow>=11.0.0
Requires-Dist: requests>=2.32.0
Requires-Dist: tqdm>=4.66.0
Requires-Dist: urllib3>=2.2.0
Requires-Dist: aiohttp>=3.10
Requires-Dist: aiofiles>=24.1.0
Requires-Dist: rich>=13.9.0
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: pytest-cov>=6.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.25.0; extra == "dev"
Requires-Dist: ruff>=0.4.7; extra == "dev"
Requires-Dist: setuptools-scm>=9.2.0; extra == "dev"
Dynamic: license-file

# Download images from IIIF manifests

[![PyPI - Version](https://img.shields.io/pypi/v/iiif-download.svg)](https://pypi.org/project/iiif-download)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/iiif-download.svg)](https://pypi.org/project/iiif-download)
![Test Status](https://img.shields.io/github/actions/workflow/status/Segolene-Albouy/iiif-download/test.yml?branch=main)

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

```bash
pip install iiif-download
```

## Basic usage

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

### Inside a script

```python
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

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

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

### Metadata extraction

```python
from iiif_download import IIIFManifest

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

## Development

Install locally
```bash
python -m venv venv && source venv/bin/activate
pip install -e ".[dev]"
```

Run tests
```bash
pytest
# pre-commit install
pre-commit run --all-files
```

Publish on PyPi
```bash
git tag v<*.*.*> && git push origin v<*.*.*>
```
