How to Load and Manipulate Images for Deep Learning in Python With PIL/Pillow

Last Updated on September 12, 2019

Before you can develop predictive models for image data, you must learn how to load and manipulate images and photographs.

The most popular and de facto standard library in Python for loading and working with image data is Pillow. Pillow is an updated version of the Python Image Library, or PIL, and supports a range of simple and sophisticated image manipulation functionality. It is also the basis for simple image support in other Python libraries such as SciPy and Matplotlib.

In this tutorial, you will discover how to load and manipulate image data using the Pillow Python library.

After completing this tutorial, you will know:

  • How to install the Pillow library and confirm it is working correctly.
  • How to load images from file, convert loaded images to NumPy arrays, and save images in new formats.
  • How to perform basic transforms to image data such as resize, flips, rotations, and cropping.

Kick-start your project with my new book Deep Learning for Computer Vision, including step-by-step tutorials and the Python source code files for all examples.

Let’s get started.

  • Updated Sep/2019: Updated to reflect minor changes to Pillow API.

Tutorial Overview

This tutorial
To finish reading, please visit source site