Scipy is deprecating their image I/O functionality.
This document is intended to help people coming from Scipy to adapt to Imageio's :func:`imread <imageio.imread>` function. We recommend reading the :doc:`user api <userapi>` and checkout some :doc:`examples <examples>` to get a feel of imageio.
Imageio makes use of variety of plugins to support reading images (and volumes/movies)
from many different formats. Fortunately, Pillow is the main plugin for common images,
which is the same library as used by Scipy's imread
. Note that Imageio
automatically selects a plugin based on the image to read (unless a format is
explicitly specified), but uses Pillow where possible.
In short terms: For images previously read by Scipy's imread, imageio should generally use Pillow as well, and imageio provides the same functionality as Scipy in these cases. But keep in mind:
- Instead of
mode
, use thepilmode
keyword argument.- Instead of
flatten
, use theas_gray
keyword argument.- The documentation for the above arguments is not on :func:`imread <imageio.imread>`, but on the docs of the individual formats, e.g. :doc:`PNG <format_png-pil>`.
- Imageio's functions all return numpy arrays, albeit as a subclass (so that meta data can be attached).