Skip to main content

mahotas-imread: Read Image Files

License Install with conda image Test mahotas-imread

IO with images and numpy arrays.

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

  • imread: Reads an image file
  • imread_multi: Reads an image file with multiple images. Currently, TIFF and STK (a TIFF sub-based format) support this function.
  • imsave: 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

Python versions 2.6, 2.7, 3.3+ are officially supported.

Citation

::: {#Citation} 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:

@article{mahotas,
    author = {Luis Pedro Coelho},
    title = {Mahotas: Open source software for scriptable computer vision},
    journal = {Journal of Open Research Software},
    year = {2013},
    doi = {https://dx.doi.org/10.5334/jors.ac},
    month = {July},
    volume = {1}
}

Installation/Dependencies

The easiest environment to install mahotas-imread is anaconda, through conda-forge. Just use:

conda config --add channels conda-forge
conda install imread

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 setup.py build

and install with:

python setup.py install

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

On nix, you can use:

nix-env -iA nixpkgs.python3Packages.imread

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

Links & Contacts

History

Version 0.7.5 (2023-11-22)

  • Fix build issue (#43, patch by @carlosal1015)

Version 0.7.4 (2020-04-14)

  • Add missing header files to distribution

Version 0.7.3 (2020-04-09)

  • Add missing test data to distribution

Version 0.7.2 (2020-03-24)

  • Fix several memory access bugs in parsers (reported by Robert Scott)

Version 0.7.1 (2019-05-09)

  • Fix 16-bit RGB/RGBA TIFF write (patch by Tomi Aarnio)

Version 0.7.0 (2018-09-30)

  • Add support for reading ImageJ ROIs

Version 0.6.1 (2018-02-15)

  • Support pathlib paths as function arguments
  • Fix 16 bit PNG write support (patch by Tomi Aarnio)

Version 0.6 (2016-09-21)

  • Add [supports_format]{.title-ref} 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 tests.run()
  • 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]{.title-ref} 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]{.title-ref})
  • 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

Release files for imread 0.7.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for imread 0.7.6
File Size Uploaded
imread-0.7.6.tar.gz 170.7 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for imread 0.7.6
File
imread-0.7.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
imread-0.7.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
imread-0.7.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details
imread-0.7.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details
imread-0.7.6-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 Details
imread-0.7.6-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ x86-64 Details

Total release size: 9.7 MB

Release files / imread-0.7.6.tar.gz

Download URL imread-0.7.6.tar.gz
Size 170.7 kB
Tags Source
SHA-256 checksum
How to use checksums
50b3d7089c862504c22b256ef51fe45851b34616db14c0ebfc5536001c996015
BLAKE2b-256 checksum
How to use checksums
7b90c0fd5983f7ec281a0adbb01eb2184d5f5d25fc448c67dadb6e70c218e519
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.9

Release files / imread-0.7.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL imread-0.7.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.6 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
21df1273c4e327e9692f235ba4d84dd0153afddeb86f12f881beb00e883d87a4
BLAKE2b-256 checksum
How to use checksums
a4c2626bfb2b07754ec2b2f92fa94cc67fbb3125c84c5d9c3576032fe99a9547
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.9

Release files / imread-0.7.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL imread-0.7.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.6 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
14564773cd7d5fac3a83ef5452b333919e2af316a590ed4e7ff07f5794f1f1eb
BLAKE2b-256 checksum
How to use checksums
545dbb0a31b8371c67218fae1b56062eb2c4de5b3eedeca0ecfaa0f5bb2dbb4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.9

Release files / imread-0.7.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL imread-0.7.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.6 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
b03ea2cde79045408ac4aca4de09bf0e4794761a4f96e5f17fc7eb51b31d9415
BLAKE2b-256 checksum
How to use checksums
ea62395593edc0bde566108f326cee76c9ec214ff96ca7001bf2cf5e9258ce07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.9

Release files / imread-0.7.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL imread-0.7.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.6 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
463ab6b79f7732fa5205478ebf027009b2b65ada37e0999830dea0a1a2ac507f
BLAKE2b-256 checksum
How to use checksums
608c8f933b56edb3a2d3136e5b93b2bec38403561414c5c003903e1e37006bb7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.9

Release files / imread-0.7.6-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL imread-0.7.6-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.6 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
4cb4f96c6e7738a314550d47232ee9351dbc936530ac699f77ee25e58b154b0e
BLAKE2b-256 checksum
How to use checksums
c83fd96002907e708722d582e8b59f71122df9da4325df616fc802dcd1cf8406
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.9

Release files / imread-0.7.6-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL imread-0.7.6-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.6 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
f7f619dd3b22e56489f47ed69d9d53a1383febb41c964bb8c6ca05e6751cd41f
BLAKE2b-256 checksum
How to use checksums
1190d1445a7207c3306d670656965de6ded9c44a3c6093ea7325eaa65335d7f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.9

Release history Release notifications | RSS feed

This release

0.7.6 This release

7 release files

0.7.5

7 release files

0.7.4

13 release files

0.7.3

7 release files

0.7.2

1 release file

0.7.1

7 release files

0.7.0

1 release file

0.6.1

1 release file

0.6

15 release files

0.5.1

1 release file

0.5

1 release file

0.4

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.6

1 release file

0.2.5

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2

1 release file

0.1

1 release file

0.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page