Matplotlib.pyplot has features that enable us to read .jpeg and .png images and covert them to pixel format to display as images.
Reading and displaying images
Getting ready
Import the required library:
import matplotlib.pyplot as plt
How to do it...
Here is the code block that reads a JPEG file as a pixel-valued list and displays it as an image on the screen:
- Read the image louvre.jpg into a three-dimensional array (color images have three channels, whereas black and white images have one channel only):
image = plt.imread('louvre.jpg')
- Print the dimensions...