How to display image in Python using Pillow

You can display an image in Python using Pillow by following the given steps. If you want to learn Computer Vision then I will highly recommend you to read This book.

How to display image in Python using Pillow
How to display image in Python using Pillow

Step 1

If Pillow library is not installed, then first install it using this code.

pip install Pillow

Step 2

The image should be in the same folder in which the code file is running. Otherwise, add the location before the image name.

# Import the Pillow library
from PIL import Image

# Read the Image
img = Image.open("man.jpg")

# Display the Image 
img.show()

# Print the type of Image
print(type(img))

Output:

<class 'PIL.JpegImagePlugin.JpegImageFile'>
Output

Free Learning Resources

Leave a Comment

Your email address will not be published.