Writing multipage TIFF with Python

The best way to write multipage TIFF (all at once or via appending) on any platform (Windows, Mac, Linux) is to just use tifffile.py  by:

pip install tifffile



Where imgs.shape is (Nimg,y,x) for monochrome or (Nimg,y,x,3) for RGB color.

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

An advanced example is the file Demo_image_write_multipage.py

Alternative Python multipage TIFF method

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

Fix scikit-image errors

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

Windows scikit-image fix

if you get error:

RuntimeError: Could not find a FreeImage library

Fix by:

  1. download the FreeImage DLL
  2. extract Dist/x64/FreeImage.dll to

     $(python -c "import skimage; print(skimage.__path__[0])")/io/_plugins/

Linux scikit-image fix

If you get error:

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

Fix by:

apt install libfreeimage3





Leave a Comment