# mahotas-imread: Read Image Files
[](https://opensource.org/licenses/MIT)
[](https://anaconda.org/conda-forge/imread)
[](https://anaconda.org/conda-forge/imread)
[](https://github.com/luispedro/imread/actions/workflows/test-python-package-with-conda.yml)
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](https://luispedro.org/software/mahotas)
for Gaussian filtering):
```python
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](https://mahotas.rtfd.io)\] or
packages from others \[[scikit-image](https://scikit-image.org/), 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](https://imread.rtfd.io/)
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](https://mahotas.rtfd.io) 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](https://dx.doi.org/10.5334/jors.ac)\]
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](https://conda-forge.github.io). Just use:
```bash
conda config --add channels conda-forge
conda install imread
```
To compile on debian/ubuntu:
```bash
sudo apt-get install libpng12-dev libtiff4-dev libwebp-dev
sudo apt-get install xcftools
```
To compile on Mac:
```bash
sudo port install libpng tiff webp
```
Either way, you can then compile with:
```bash
python setup.py build
```
and install with:
```bash
python setup.py install
```
On Windows, you can also just download a pre-built package from [C.
Gohlke\'s
repository](https://www.lfd.uci.edu/~gohlke/pythonlibs/#imread)
On nix, you can use:
```
nix-env -iA nixpkgs.python3Packages.imread
```
or use the `pkgs.python3Packages.imread` object in your `*.nix` files.
## Links & Contacts
- *Documentation*: https://imread.readthedocs.io/
- *Issue Tracker*: [github imread issues](https://github.com/luispedro/imread)
- *Mailing List*: Use the [pythonvision mailing list](https://groups.google.com/group/pythonvision?pli=1) for questions, bug submissions, etc.
- *Main Author & Maintainer*: [Luis Pedro Coelho](https://luispedro.org) (follow on [twitter](https://twitter.com/luispedrocoelho) or [github](https://github.com/luispedro)).
### 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
Raw data
{
"_id": null,
"home_page": "http://luispedro.org/software/imread",
"name": "imread",
"maintainer": null,
"docs_url": "https://pythonhosted.org/imread/",
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Luis Pedro Coelho",
"author_email": "luis@luispedro.org",
"download_url": "https://files.pythonhosted.org/packages/7b/90/c0fd5983f7ec281a0adbb01eb2184d5f5d25fc448c67dadb6e70c218e519/imread-0.7.6.tar.gz",
"platform": "Any",
"description": "# mahotas-imread: Read Image Files\n\n[](https://opensource.org/licenses/MIT)\n[](https://anaconda.org/conda-forge/imread)\n[](https://anaconda.org/conda-forge/imread)\n[](https://github.com/luispedro/imread/actions/workflows/test-python-package-with-conda.yml)\n\nIO with images and numpy arrays.\n\nMahotas-imread is a simple module with a small number of functions:\n\n- `imread`: Reads an image file\n- `imread_multi`: Reads an image file with multiple images. Currently, TIFF and STK (a TIFF sub-based format) support this function.\n- `imsave`: Writes an image file\n\nExample (which uses [mahotas](https://luispedro.org/software/mahotas)\nfor Gaussian filtering):\n\n\n```python\nfrom imread import imread, imsave\nfrom mahotas import gaussian_filter\nlena = imread('lena.jpeg')\n\nlena = gaussian_filter(lena.astype(float), 4.)\nimsave('lena-filtered.jpeg', lena)\n```\n\nThis grew out of frustration at current image loading solutions in\nPython, in either my packages \\[[mahotas](https://mahotas.rtfd.io)\\] or\npackages from others \\[[scikit-image](https://scikit-image.org/), for\nexample\\].\n\nThe relationship with numpy is very contained and this could be easily\nrepurposed to load images in other frameworks, even other programming\nlanguages.\n\n[Online documentation](https://imread.rtfd.io/)\n\nPython versions 2.6, 2.7, 3.3+ are officially supported.\n\n## Citation\n\n::: {#Citation}\nIf you use imread on a published publication, please cite the main\n[mahotas](https://mahotas.rtfd.io) paper (imread is a spin-off of\nmahotas):\n:::\n\n> **Luis Pedro Coelho** Mahotas: Open source software for scriptable\n> computer vision in Journal of Open Research Software, vol 1, 2013.\n> \\[[DOI](https://dx.doi.org/10.5334/jors.ac)\\]\n\nIn Bibtex format:\n\n```\n@article{mahotas,\n author = {Luis Pedro Coelho},\n title = {Mahotas: Open source software for scriptable computer vision},\n journal = {Journal of Open Research Software},\n year = {2013},\n doi = {https://dx.doi.org/10.5334/jors.ac},\n month = {July},\n volume = {1}\n}\n```\n\n### Installation/Dependencies\n\nThe easiest environment to install mahotas-imread is anaconda, through\n[conda-forge](https://conda-forge.github.io). Just use:\n\n\n```bash\nconda config --add channels conda-forge\nconda install imread\n```\n\nTo compile on debian/ubuntu:\n\n```bash\nsudo apt-get install libpng12-dev libtiff4-dev libwebp-dev\nsudo apt-get install xcftools\n```\n\nTo compile on Mac:\n\n```bash\nsudo port install libpng tiff webp\n```\n\nEither way, you can then compile with:\n\n```bash\npython setup.py build\n```\n\nand install with:\n\n```bash\npython setup.py install\n```\n\nOn Windows, you can also just download a pre-built package from [C.\nGohlke\\'s\nrepository](https://www.lfd.uci.edu/~gohlke/pythonlibs/#imread)\n\nOn nix, you can use:\n\n```\nnix-env -iA nixpkgs.python3Packages.imread\n```\n\nor use the `pkgs.python3Packages.imread` object in your `*.nix` files.\n\n## Links & Contacts\n\n- *Documentation*: https://imread.readthedocs.io/\n- *Issue Tracker*: [github imread issues](https://github.com/luispedro/imread)\n- *Mailing List*: Use the [pythonvision mailing list](https://groups.google.com/group/pythonvision?pli=1) for questions, bug submissions, etc.\n- *Main Author & Maintainer*: [Luis Pedro Coelho](https://luispedro.org) (follow on [twitter](https://twitter.com/luispedrocoelho) or [github](https://github.com/luispedro)).\n\n### History\n\n## Version 0.7.5 (2023-11-22)\n\n- Fix build issue (#43, patch by \\@carlosal1015)\n\n## Version 0.7.4 (2020-04-14)\n\n- Add missing header files to distribution\n\n## Version 0.7.3 (2020-04-09)\n\n- Add missing test data to distribution\n\n## Version 0.7.2 (2020-03-24)\n\n- Fix several memory access bugs in parsers (reported by Robert Scott)\n\n## Version 0.7.1 (2019-05-09)\n\n- Fix 16-bit RGB/RGBA TIFF write (patch by Tomi Aarnio)\n\n## Version 0.7.0 (2018-09-30)\n\n- Add support for reading ImageJ ROIs\n\n## Version 0.6.1 (2018-02-15)\n\n- Support pathlib paths as function arguments\n- Fix 16 bit PNG write support (patch by Tomi Aarnio)\n\n## Version 0.6 (2016-09-21)\n\n- Add [supports_format]{.title-ref} function\n- Make png compression level tunable when calling imsave\n- Add imsave_multi\n- Add partial support for reading PNG files in Gray+alpha format\n\n## Version 0.5.1 (2014-11-06)\n\n- Improve tests to work after installation\n- Fix compilation in MSVC (patch by Christoph Gohlke)\n\n## Version 0.5 (2014-10-16)\n\n- Add magic-number based format auto-detection\n- Auto detect whether webp is installed\n- Fix WebP reading (update to newer API)\n\n## Version 0.4 (2014-07-21)\n\n- Add configuration for TIFF saving\n- Correctly save 16 bit PNG images\n- Better error messages for JPEG\n\n## Version 0.3.2 (2013-10-06)\n\n- Added imload\\*/imwrite synonyms as suggested by Thouis (Ray) Jones\n- Options framework\n- Allow user to specify JPEG quality when saving\n- Fix loading of 16 bit PNG images\n\n## Version 0.3.1 (2013-06-20)\n\n- Fix possible crash on error with TIFF\n- Fix compilation on Windows (reported by Volker Hilsenstein)\n- Make it easy to compile without WebP\n\n## Version 0.3.0 (2013-07-29)\n\n- Support for reading from in-memory blobs\n- Support for reading & writing TIFF metadata\n- Add PHOTOMETRIC tag to TIFF (reported by Volker Hilsenstein)\n- Support writing RGB TIFFs\n\n## Version 0.2.6 (2013-06-19)\n\n- Fix hard crash when saving with non-existing file type\n- Fix compilation on MacOS (patch by Alexander Bohn)\n- Add `verbose` argument to tests.run()\n- Better error when attempting to save floating point images\n\n## Version 0.2.5 (2012-10-29)\n\n- Correctly accept uppercase extensions\n- Python 3 support (patch by Christoph Gohlke \\[pull request 8 on\n github\\])\n- Read 1-Bit PNGs\n- Read simple BMPs (compression and many bit types not supported)\n- More complete debug mode (export DEBUG=2 when building), more checks\n\n## Version 0.2.4 (2012-06-26)\n\n- Add lzw.cpp to source distribution\n- Support saving 16-bit TIFF\n- Better Mac OS support (patch from Alexander Bohn)\n\n## Version 0.2.3 (2012-06-8)\n\n- Fix imread_multi\n\n## Version 0.2.2 (2012-06-5)\n\n- Add [formatstr]{.title-ref} argument to imread\n- Open files in binary mode on Windows (patch by Christoph Gohlke)\n- Read-only support for LSM files\n- Read-only support for XCF files (through [xcf2png]{.title-ref})\n- Fix writing of non-contiguous images (at least PNG was affected)\n\n## Version 0.2.1 (2012-02-11)\n\n- Add missing files to distribution\n\n## Version 0.2 (2012-03-19)\n\n- Compile on MSVC++ (Patches by Christoph Gohlke)\n- Support for WebP\n- Support for 1-bit TIFFs\n- Better error message\n- Support for multi-page TIFF reading\n- Experimental read-only support for STK files\n\n## Version 0.1 (2012-02-28)\n\n- Support for PNG\n- Support for TIFF\n- Support for JPEG\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "imread: Image reading library",
"version": "0.7.6",
"project_urls": {
"Homepage": "http://luispedro.org/software/imread"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "545dbb0a31b8371c67218fae1b56062eb2c4de5b3eedeca0ecfaa0f5bb2dbb4e",
"md5": "8032734cd785c6b41b5a018addbf24c3",
"sha256": "14564773cd7d5fac3a83ef5452b333919e2af316a590ed4e7ff07f5794f1f1eb"
},
"downloads": -1,
"filename": "imread-0.7.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "8032734cd785c6b41b5a018addbf24c3",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": null,
"size": 1586006,
"upload_time": "2024-08-03T01:49:05",
"upload_time_iso_8601": "2024-08-03T01:49:05.611657Z",
"url": "https://files.pythonhosted.org/packages/54/5d/bb0a31b8371c67218fae1b56062eb2c4de5b3eedeca0ecfaa0f5bb2dbb4e/imread-0.7.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a4c2626bfb2b07754ec2b2f92fa94cc67fbb3125c84c5d9c3576032fe99a9547",
"md5": "ab247c6d08af14497e05bf341f5df629",
"sha256": "21df1273c4e327e9692f235ba4d84dd0153afddeb86f12f881beb00e883d87a4"
},
"downloads": -1,
"filename": "imread-0.7.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "ab247c6d08af14497e05bf341f5df629",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": null,
"size": 1587155,
"upload_time": "2024-08-03T01:49:09",
"upload_time_iso_8601": "2024-08-03T01:49:09.589329Z",
"url": "https://files.pythonhosted.org/packages/a4/c2/626bfb2b07754ec2b2f92fa94cc67fbb3125c84c5d9c3576032fe99a9547/imread-0.7.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1190d1445a7207c3306d670656965de6ded9c44a3c6093ea7325eaa65335d7f4",
"md5": "3b86cce087943732d7c451897f3d8e9f",
"sha256": "f7f619dd3b22e56489f47ed69d9d53a1383febb41c964bb8c6ca05e6751cd41f"
},
"downloads": -1,
"filename": "imread-0.7.6-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "3b86cce087943732d7c451897f3d8e9f",
"packagetype": "bdist_wheel",
"python_version": "cp36",
"requires_python": null,
"size": 1585600,
"upload_time": "2024-08-03T01:49:13",
"upload_time_iso_8601": "2024-08-03T01:49:13.163967Z",
"url": "https://files.pythonhosted.org/packages/11/90/d1445a7207c3306d670656965de6ded9c44a3c6093ea7325eaa65335d7f4/imread-0.7.6-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c83fd96002907e708722d582e8b59f71122df9da4325df616fc802dcd1cf8406",
"md5": "284b81275127e0c70ffb27c67d5cb0d3",
"sha256": "4cb4f96c6e7738a314550d47232ee9351dbc936530ac699f77ee25e58b154b0e"
},
"downloads": -1,
"filename": "imread-0.7.6-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "284b81275127e0c70ffb27c67d5cb0d3",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 1586028,
"upload_time": "2024-08-03T01:49:16",
"upload_time_iso_8601": "2024-08-03T01:49:16.475198Z",
"url": "https://files.pythonhosted.org/packages/c8/3f/d96002907e708722d582e8b59f71122df9da4325df616fc802dcd1cf8406/imread-0.7.6-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "608c8f933b56edb3a2d3136e5b93b2bec38403561414c5c003903e1e37006bb7",
"md5": "56ffe35048242eff14526abf8e08279d",
"sha256": "463ab6b79f7732fa5205478ebf027009b2b65ada37e0999830dea0a1a2ac507f"
},
"downloads": -1,
"filename": "imread-0.7.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "56ffe35048242eff14526abf8e08279d",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": null,
"size": 1587820,
"upload_time": "2024-08-03T01:49:19",
"upload_time_iso_8601": "2024-08-03T01:49:19.760022Z",
"url": "https://files.pythonhosted.org/packages/60/8c/8f933b56edb3a2d3136e5b93b2bec38403561414c5c003903e1e37006bb7/imread-0.7.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ea62395593edc0bde566108f326cee76c9ec214ff96ca7001bf2cf5e9258ce07",
"md5": "8ed394a96d668692e9662e021272b6ed",
"sha256": "b03ea2cde79045408ac4aca4de09bf0e4794761a4f96e5f17fc7eb51b31d9415"
},
"downloads": -1,
"filename": "imread-0.7.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "8ed394a96d668692e9662e021272b6ed",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": null,
"size": 1586047,
"upload_time": "2024-08-03T01:49:22",
"upload_time_iso_8601": "2024-08-03T01:49:22.555579Z",
"url": "https://files.pythonhosted.org/packages/ea/62/395593edc0bde566108f326cee76c9ec214ff96ca7001bf2cf5e9258ce07/imread-0.7.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7b90c0fd5983f7ec281a0adbb01eb2184d5f5d25fc448c67dadb6e70c218e519",
"md5": "901c07c0de9cc78d3039a9c80b6b1584",
"sha256": "50b3d7089c862504c22b256ef51fe45851b34616db14c0ebfc5536001c996015"
},
"downloads": -1,
"filename": "imread-0.7.6.tar.gz",
"has_sig": false,
"md5_digest": "901c07c0de9cc78d3039a9c80b6b1584",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 170681,
"upload_time": "2024-08-03T01:50:14",
"upload_time_iso_8601": "2024-08-03T01:50:14.854506Z",
"url": "https://files.pythonhosted.org/packages/7b/90/c0fd5983f7ec281a0adbb01eb2184d5f5d25fc448c67dadb6e70c218e519/imread-0.7.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-03 01:50:14",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "imread"
}