Change ImageFolder from PIL to ImageIO?

ImageFolder is a super useful dataloader, but it relies on PIL. How about using ImageIO library instead? It supports a unified interface to read / write hundreds of file formats including DICOM and TIFF.

ImageIO Library Overview

API in a nutshell

As a user, you just have to remember a handfull of functions:

  1. imread() and imwrite() - for single images
  2. mimread() and mimwrite() - for image series (animations)
  3. volread() and volwrite() - for volumetric image data
  4. get_reader() and get_writer() - for more control (e.g. streaming)
    See the user api for more information


  1. Simple interface via a consise set of functions.
  2. Easy to install using conda or pip.
  3. Few dependencies (only Numpy).
  4. Pure Python, runs on Python 2.6+, 3.x, and Pypy
  5. Cross platform, runs on Windows, Linux, OS X (Raspberry Pi planned)
  6. Lots of supported formats.
  7. Can read from file names, file objects, zipfiles, http/ftp, and raw bytes.
  8. Easy to extend using plugins.
  9. Code quality is maintained with many tests and continuous integration.


Imageio has a relatively simple core that provides a common interface to different file formats. This core takes care of reading from different sources (like http), and exposes a simple API for the plugins to access the raw data. All file formats are implemented in plugins. Additional plugins can easily be registered.

Some plugins rely on external libraries (e.g. freeimage). These are automatically downloaded when needed and cached in your appdata directory. This keeps imageio light and scalable.

We plan to provide a wide range of image formats. Also scientific formats. Any help in implementing more formats is very welcome!

The codebase adheres to (a subset of) the PEP8 style guides. We strive for maximum test coverage (100% for the core, >95% for each plugin).

Origin and outlook

Imageio was based out of the frustration that many libraries that needed to read or write image data produced their own functionality for IO. PIL did not meet the needs very well, and libraries like scikit-image need to be able to deal with scientific formats. I felt there was a need for a good image io library, which is an easy dependency, easy to maintain, and scalable to exotic file formats.

Imageio started out with the FreeImage plugin of the scikit-image project, through which it was able to support a lot of common formats. We created a simple but powerful core, a clean user API, and a proper plugin system.

The purpose of imageio is to support reading and writing of image data. We’re not processing images, you should use scikit-image for that. Imageio should be easy to install and be lightweight. Imageio’s plugin system makes it possible to scale the number of supported formats and still keep a low footprint.