
Overview
I created a program to generate Pyramid Tiled TIFF files using pyvips. You can try it on the following Google Colab.
Google Colab
When delivering images via IIIF, there are situations where Pyramid Tiled TIFF files need to be created. We hope this is helpful for image conversion using Python and Vips.
The parameters are based on the following.
GitHub - samvera/serverless-iiif: IIIF Image API 2.1 & 3.0 server in an AWS Serverless Application
IIIF Image API 2.1 & 3.0 server in an AWS Serverless Application - samvera/serverless-iiif
Also, as one example of how to deliver converted Pyramid Tiled TIFF files, the following article may also be helpful.

Building an IIIF Image Server with AWS Serverless Application
Building an IIIF Image Server with AWS serverless application
Key Points
Installing vips
To use pyvips, vips must be installed in advance. The following is helpful.
libvips
A fast image processing library with low memory needs.
Creating Pyramid Tiled TIFF Files with pyvips
Use as follows.
import pyvips
ins = pyvips.Image.new_from_file(<input image file path>)
ins.tiffsave(<output image file path>,
tile=True,
compression='jpeg',
pyramid=True,
tile_width=256,
tile_height=256)
The above should produce the same result as the following.
vips tiffsave <input image file path> <output image file path> --tile --pyramid --compression jpeg --tile-width 256 --tile-height 256



Comments
โฆ