Skip to main content

imread: Image reading library

Project description

https://api.travis-ci.com/luispedro/imread.png https://anaconda.org/conda-forge/imread/badges/license.svg https://anaconda.org/conda-forge/imread/badges/installer/conda.svg https://anaconda.org/conda-forge/imread/badges/downloads.svg

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.

Python 3.2 (and earlier versions in the Python 3 series) are officially not supported. Patches will be accepted if they do not mess up anything else, but bug reports will not be considered as very high priority.

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.

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 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 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

imread-0.7.5.tar.gz (130.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

imread-0.7.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

imread-0.7.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

imread-0.7.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

imread-0.7.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

imread-0.7.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

imread-0.7.5-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.17+ x86-64

File details

Details for the file imread-0.7.5.tar.gz.

File metadata

  • Download URL: imread-0.7.5.tar.gz
  • Upload date:
  • Size: 130.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for imread-0.7.5.tar.gz
Algorithm Hash digest
SHA256 1a25a9035dbc1ae2e56c15b50904071d555ea197eef58ca1d9117349db470db7
MD5 44b5f8ff075d2f020433c7dc0b5d94c0
BLAKE2b-256 fd2a217f661b63b7c7d3bc028780e33d52e978d0df75f6d925c7c436d0e63d4f

See more details on using hashes here.

File details

Details for the file imread-0.7.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for imread-0.7.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7f34b31c36acbb249ee7f91840634a8a6bb94ae37f7ea36580915112469582cf
MD5 00f54603c5fd588fde3a8897b9f1ac80
BLAKE2b-256 e12263d736789f4edaa98d756f51272d84bf6c3f6eb27e169f50b5dcaebdd3d7

See more details on using hashes here.

File details

Details for the file imread-0.7.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for imread-0.7.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 407adfd89e74785033095b3f9decf80d0432f7c4d2058a8eb3b0624c849fcc85
MD5 b8e162bddc74fffa444ce81e449ffcf1
BLAKE2b-256 1dc2cccda93a46baf58eb52e5c7c383bf83664d8ec16d86037a30069502b5fbb

See more details on using hashes here.

File details

Details for the file imread-0.7.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for imread-0.7.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fd3a103d4ade94d325c92c8fdb5f4962d0d8d088d62d6852a34435d565f10609
MD5 4614070af5a4b87e5dfe62993a4bd672
BLAKE2b-256 26998cbf90686b43d64ddbce85d96f69b3a43849006c4f922d182a6db792625e

See more details on using hashes here.

File details

Details for the file imread-0.7.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for imread-0.7.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a5afdbaa77cfadf27934a9e1fe4402ab058cdc7b8f85475cf8f39b779aeeae0a
MD5 f3ea4108c3a4bcbfb2ad21c7137d7764
BLAKE2b-256 7128469cecd85d48833f0a1d50790699309e81de9c5b26be05090fb1dea09c73

See more details on using hashes here.

File details

Details for the file imread-0.7.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for imread-0.7.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c85c1f00fa2bcb8f7c0ecea2b169ce14ff4fae68c12596ed0c3dc6a0f9d5ba3a
MD5 911e6903d9c5f935b552f4a0e9ae95f1
BLAKE2b-256 ede9a49f1e50b4e2057435e251f670b22ae0a9a9dca467db7bb7dcd1520b0d62

See more details on using hashes here.

File details

Details for the file imread-0.7.5-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for imread-0.7.5-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2f367a0136e0d400d325571683efca63bd12acb7d1b698c3e9109f7c6fb7860d
MD5 e5e8e328e98c7219cedf2bdec9b7c684
BLAKE2b-256 980db613a05830d401ed21001ed71f33d3f38b24360e3d54892ad02016b915f4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page