skip to navigation
skip to content

imread 0.6

imread: Image reading library

Package Documentation

[![Travis](]( [![License](](

Mahotas-imread is a simple module with a small number of functions:

Reads an image file
Reads an image file with multiple images. Currently, TIFF and STK (a TIFF sub-based format) support this function.
Writes an image file

Example (which uses mahotas for Gaussian filtering):

from imread import imread, imsave
from mahotas import gaussian_filter
lena = imread('lena.jpeg')

lena = gaussian_filter(lena.astype(float), 4.)
imsave('lena-filtered.jpeg', lena)

This grew out of frustration at current image loading solutions in Python, in either my packages [mahotas] or packages from others [scikit-image, for example].

The relationship with numpy is very contained and this could be easily repurposed to load images in other frameworks, even other programming languages.

Online documentation


If you use imread on a published publication, please cite the main mahotas paper (imread is a spin-off of mahotas):

Luis Pedro Coelho Mahotas: Open source software for scriptable computer vision in Journal of Open Research Software, vol 1, 2013. [DOI]

In Bibtex format:

    author = {Luis Pedro Coelho},
    title = {Mahotas: Open source software for scriptable computer vision},
    journal = {Journal of Open Research Software},
    year = {2013},
    doi = {},
    month = {July},
    volume = {1}


The easiest environment to install mahotas-imread is on nix, just use:

nix-env -iA nixpkgs.python27Packages.imread

or use the pkgs.python27Packages.imread object in your *.nix files.

To compile on debian/ubuntu:

sudo apt-get install libpng12-dev libtiff4-dev libwebp-dev
sudo apt-get install xcftools

To compile on Mac:

sudo port install libpng tiff webp

Either way, you can then compile with:

python build

and install with:

python install

On Windows, you can also just download a pre-built package from C. Gohlke’s repository

Version 0.6 (2016-09-21)

  • Add supports_format function
  • Make png compression level tunable when calling imsave
  • Add imsave_multi
  • Add partial support for reading PNG files in Gray+alpha format

Version 0.5.1 (2014-11-06)

  • Improve tests to work after installation
  • Fix compilation in MSVC (patch by Christoph Gohlke)

Version 0.5 (2014-10-16)

  • Add magic-number based format auto-detection
  • Auto detect whether webp is installed
  • Fix WebP reading (update to newer API)

Version 0.4 (2014-07-21)

  • Add configuration for TIFF saving
  • Correctly save 16 bit PNG images
  • Better error messages for JPEG

Version 0.3.2 (2013-10-06)

  • Added imload*/imwrite synonyms as suggested by Thouis (Ray) Jones
  • Options framework
  • Allow user to specify JPEG quality when saving
  • Fix loading of 16 bit PNG images

Version 0.3.1 (2013-06-20)

  • Fix possible crash on error with TIFF
  • Fix compilation on Windows (reported by Volker Hilsenstein)
  • Make it easy to compile without WebP

Version 0.3.0 (2013-07-29)

  • Support for reading from in-memory blobs
  • Support for reading & writing TIFF metadata
  • Add PHOTOMETRIC tag to TIFF (reported by Volker Hilsenstein)
  • Support writing RGB TIFFs

Version 0.2.6 (2013-06-19)

  • Fix hard crash when saving with non-existing file type
  • Fix compilation on MacOS (patch by Alexander Bohn)
  • Add verbose argument to
  • Better error when attempting to save floating point images

Version 0.2.5 (2012-10-29)

  • Correctly accept uppercase extensions
  • Python 3 support (patch by Christoph Gohlke [pull request 8 on github])
  • Read 1-Bit PNGs
  • Read simple BMPs (compression and many bit types not supported)
  • More complete debug mode (export DEBUG=2 when building), more checks

Version 0.2.4 (2012-06-26)

  • Add lzw.cpp to source distribution
  • Support saving 16-bit TIFF
  • Better Mac OS support (patch from Alexander Bohn)

Version 0.2.3 (2012-06-8)

  • Fix imread_multi

Version 0.2.2 (2012-06-5)

  • Add formatstr argument to imread
  • Open files in binary mode on Windows (patch by Christoph Gohlke)
  • Read-only support for LSM files
  • Read-only support for XCF files (through xcf2png)
  • Fix writing of non-contiguous images (at least PNG was affected)

Version 0.2.1 (2012-02-11)

  • Add missing files to distribution

Version 0.2 (2012-03-19)

  • Compile on MSVC++ (Patches by Christoph Gohlke)
  • Support for WebP
  • Support for 1-bit TIFFs
  • Better error message
  • Support for multi-page TIFF reading
  • Experimental read-only support for STK files

Version 0.1 (2012-02-28)

  • Support for PNG
  • Support for TIFF
  • Support for JPEG
File Type Py Version Uploaded on Size
imread-0.6-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (md5, pgp) Python Wheel cp27 2017-01-15 1MB
imread-0.6-cp27-cp27m-manylinux1_i686.whl (md5, pgp) Python Wheel cp27 2017-01-15 2MB
imread-0.6-cp27-cp27m-manylinux1_x86_64.whl (md5, pgp) Python Wheel cp27 2017-01-15 3MB
imread-0.6-cp27-cp27mu-manylinux1_i686.whl (md5, pgp) Python Wheel cp27 2017-01-15 2MB
imread-0.6-cp27-cp27mu-manylinux1_x86_64.whl (md5, pgp) Python Wheel cp27 2017-01-15 3MB
imread-0.6-cp34-cp34m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (md5, pgp) Python Wheel cp34 2017-01-15 1MB
imread-0.6-cp34-cp34m-manylinux1_i686.whl (md5, pgp) Python Wheel cp34 2017-01-15 2MB
imread-0.6-cp34-cp34m-manylinux1_x86_64.whl (md5, pgp) Python Wheel cp34 2017-01-15 3MB
imread-0.6-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (md5, pgp) Python Wheel cp35 2017-01-15 1MB
imread-0.6-cp35-cp35m-manylinux1_i686.whl (md5, pgp) Python Wheel cp35 2017-01-15 2MB
imread-0.6-cp35-cp35m-manylinux1_x86_64.whl (md5, pgp) Python Wheel cp35 2017-01-15 3MB
imread-0.6-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (md5, pgp) Python Wheel cp36 2017-01-15 1MB
imread-0.6-cp36-cp36m-manylinux1_i686.whl (md5, pgp) Python Wheel cp36 2017-01-15 2MB
imread-0.6-cp36-cp36m-manylinux1_x86_64.whl (md5, pgp) Python Wheel cp36 2017-01-15 3MB
imread-0.6.tar.gz (md5) Source 2016-09-21 113KB