Loading and displaying an image using the Pillow library


In this program, we will read or load an image using the pillow library. The pillow library consists of a method called Image.open(). This function takes the file path or the name of the file as a string. To display the image, we use another function show(). It does not require any parameter.

Example Code

from PIL import Image

im = Image.open('testimage.jpg')
im.show()

Output

Updated on: 17-Mar-2021

138 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements