Use Imagemagick to efficiently create derivative tiles of a very large image, and structure them into directories compliant with IIIF Level 0
Project description
magick-tile
This package and command-line utility relies on Imagemagick to efficiently create derivative tiles of a very large image, and structure them into directories compliant with IIIF Level 0 specification for static sites.
This takes inspiration heavily from https://github.com/zimeon/iiif/blob/master/iiif_static.py, but uses ImageMagick rather than Pillow in order to speed up generation at the expense of a less flexible treatment of images.
Prerequisites
- Python > 3.9
- Imagemagick must be available on your path
Installation
pip install magick-tile
Run
Usage: magick_tile [OPTIONS] SOURCE OUTPUT IDENTIFIER
Efficiently create derivative tiles of a very large image, and structure them into
directories compliant with IIIF Level 0.
╭─ Arguments ──────────────────────────────────────────────────────────────────────╮
│ * source FILE [required] │
│ * output DIRECTORY Destination directory for tiles [required] │
│ * identifier TEXT Image identifier to be written to final │
│ info.json (e.g. │
│ https://example.com/iiif/my_image) │
│ [required] │
╰──────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ────────────────────────────────────────────────────────────────────────╮
│ --tile-size INTEGER Tile size to produce │
│ [default: 512] │
│ --format [jpg|tif|png|gif|jp2|pdf File formats to generate │
│ |webp] (must be supported by │
│ Imagemagick's 'convert') │
│ [default: jpg] │
│ --install-completion Install completion for the │
│ current shell. │
│ --show-completion Show completion for the │
│ current shell, to copy it │
│ or customize the │
│ installation. │
│ --help Show this message and │
│ exit. │
╰──────────────────────────────────────────────────────────────────────────────────╯
This will create and populate the specified output directory with tiles from a given image.
N.b. because several of the Imagemagick utilities called here already utilize multiple cores, returns for running this script in parallel diminish rapidly.
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
Built Distribution
Hashes for magick_tile-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02997443aaef875fb6c43a3597c80dd7361038b3933305ee1254e05d25a18a51 |
|
MD5 | 6fee3a536d07ac9fdbb10fb2b849a65c |
|
BLAKE2b-256 | c4c224d50b1c4ac0d3bc6290fed83627807e8c9a74c2b041e60f77ab81542cf1 |