Transitioning from Scipy’s imread#
Scipy has depreciated their image I/O functionality.
This document is intended to help people coming from
to adapt to ImageIO’s
We recommend reading the user api and checking out some
examples to get a feel of ImageIO.
ImageIO makes use of a variety of backends to support reading images (and
volumes/movies) from many different formats. One of these backends is Pillow,
which is the same library as used by Scipy’s
imread. This means that all
image formats that were supported by scipy are supported by ImageIO. At the same
time, Pillow is not the only backend of ImageIO, and those other backends give
you give you access to additional formats. To manage this, ImageIO automatically
selects the right backend to use based on the source to read (which you can of
course control manually, should you wish to do so).
In short terms: In most places where you used Scipy’s imread, ImageIO’s imread is a drop-in replacement and ImageIO provides the same functionality as Scipy in these cases. In some cases, you will need to update the keyword arguments used.
mode, use the
flatten, use the
The documentation for the above arguments is not on
imread, but on the docs of the individual plugins, e.g.
ImageIO’s functions all return numpy arrays, albeit as a subclass (so that meta data can be attached).