Writing multipage TIFF with Python

An easy, robust way to write multipage TIFF on any platform in Python is imageio For all examples:

(Nimg, y, x) for monochrome. (Nimg, y, x, 3) for RGB color.
python -m pip install imageio
import imageio



ImageIO uses tifffile internally, so most don’t need to use tifffile directly. To use tifffile directly, install tifffile.py:

python -m pip install tifffile


import tifffile


tifffile.imsave() is capable of description and tags arguments and to compress losslessly.

Advanced Python TIFF multi-page writing example: archive/old_tiffile_demo.py.

Read TIFF headers

The de facto TIFF header tags. can be read from the command line with Perl Image::ExifTool

apt install libimage-exiftool-perl

exiftool myfile.tif

Note: tiffinfo doesn’t print tiff tags.

Print all TIFF tags from Python using archive/PrintTiffTags.py

Other methods

Alternative multipage-Tiff method using scikit-image and FreeImage: (we recommend imageio or tifffile instead)

from skimage.io._plugins import freeimage_plugin as freeimg


Fix scikit-image errors

Due to the large number of image libraries invoked, sometimes scikit-image needs a little tweaking for image I/O:


if you get error:

RuntimeError: Could not find a FreeImage library

Fix by:

  1. download the FreeImage binaries
  2. extract Dist/x64/FreeImage.dll to
   $(python -c "import skimage; print(skimage.__path__[0])")/io/_plugins/


If you get error:

freeimage had a problem: Could not find a FreeImage library in any of…

Fix by:

apt install libfreeimage3


Old Numpy

I worked around this issue by

python -m pip install numpy

python -m pip install tifffile

Since there is a Numpy .whl for ARM, the latest Numpy installs quickly on Raspberry Pi.

This fixes tifffile error:

RuntimeError: module compiled against API version 0xb but this version of numpy is 0xa