Complete the code to import the library used for image plotting.
import [1] as plt
We use matplotlib.pyplot to plot images and graphs in Python.
Complete the code to load an image file named 'photo.png' using matplotlib.
image = plt.[1]('photo.png')
The imread function reads an image file into an array for processing.
Fix the error in the code to display the loaded image correctly.
plt.[1](image)
plt.show()The imshow function displays image data on the plot.
Fill both blanks to create a dictionary with image filenames as keys and their sizes as values.
sizes = {file: image.[1] for file in files if image.[2] > 1000}ndim which only gives the number of dimensions, not size.dtype which gives data type, not size.shape gives the dimensions of the image array, and size gives the total number of pixels.
Fill all three blanks to filter images by width and create a dictionary of their heights.
heights = {file: image.shape[[1]] for file, image in images.items() if image.shape[[2]] [3] 500}Index 1 of shape is width, index 0 is height. We filter images with width greater than 500 pixels.