How to display an Image in Python

There are various modules that you can make use of to display Images using Python code. We will take a look at the most used one i.e. Pillow (PIL).


Example: Display Image

import requests
from PIL import Image
from io import BytesIO

image_URL = 'https://code2care.org/code2care-logo.png'
response = requests.get(image_URL)
img = Image.open(BytesIO(response.content))

img.show()
Display Image using Python Code

Comments & Discussion

Facing issues? Have questions? Post them here! We're happy to help!