matplotlib
is one of the multiple libraries provided by Python.
The main purpose of matplotlib
is to provide us with data visualization. This library is based on numpy
, and the purpose of designing this library is to work with the border SciPy stack.
Matplotlib has a sub-library known as pyplot
, which makes it a visual open-source like Matlab.
imread()
is a function provided by the matplotlib.pyplot
library, and is used to read an image and store it in the form of an array.
matplotlib.pyplot.imread(fname, format=None)
fname
: This is the name of the image to be read.format
: This is the file format for reading images.# Importing modulesimport matplotlib.pyplot as plt# Reading image using imreadimage=plt.imread("educative.jpeg")# Displaying read imageplt.imshow(image)
Line 2: We import the matplotlib.pyplot
library.
Line 5: We read the image using the imread()
function.
Line 8: We display the read image using imshow()
.
Free Resources