To convert the PIL Image to Numpy array, use the np.array() method and pass the image data to the np.array() method. It will return the array consists of pixel values. Pillow is the Python imaging library that supports a range of image file formats such as PNG, JPEG, PPM, GIF, TIFF, and BMP.

Pillow supports operations like  cropping,  resizing, adding text to images, rotating, greyscaling.

Convert PIL Image to Numpy Array

To convert the PIL Image to Numpy array, first, we have to open the Image using PIL’s Image module. The Image module provides the Image.open() method. Then we get the image data and then pass the image data to the np.array() method to get the array of image data.

Our original image is the following.

#python

How to Convert PIL Image to Numpy Array in Python
2.45 GEEK