Skip to main content

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

PyPi version pytest

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.


Matthew Lincoln

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

magick_tile-0.1.1.tar.gz (7.4 kB view hashes)

Uploaded Source

Built Distribution

magick_tile-0.1.1-py3-none-any.whl (8.8 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