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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

magick_tile-0.1.1-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file magick_tile-0.1.1.tar.gz.

File metadata

  • Download URL: magick_tile-0.1.1.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.8 Darwin/22.1.0

File hashes

Hashes for magick_tile-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3f332470e88a13b424dd11ee205a0c4836ad2c28620ecfe5c79ae604d1c438ff
MD5 53b3b56faa91f19c0f99e58500fbfa12
BLAKE2b-256 57d15574ab97c33c1e24731e9be8c8e175e67b9c5849c7efb1c5d2763c707cf8

See more details on using hashes here.

File details

Details for the file magick_tile-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: magick_tile-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.8 Darwin/22.1.0

File hashes

Hashes for magick_tile-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 02997443aaef875fb6c43a3597c80dd7361038b3933305ee1254e05d25a18a51
MD5 6fee3a536d07ac9fdbb10fb2b849a65c
BLAKE2b-256 c4c224d50b1c4ac0d3bc6290fed83627807e8c9a74c2b041e60f77ab81542cf1

See more details on using hashes here.

Supported by

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