What's the difference between mpimg.imread and plt.imread when I read an image with Python?

Question:

I’m trying to read an image, and I found that both following sentences are okay, so what’s the difference?

import matplotlib.pyplot as plt
img = plt.imread("1.jpg")

or

import matplotlib.image as mpimg
img = mpimg.imread('1.jpg')
Asked By: Paul

||

Answers:

Based off of the source for matplotlib.pyplot.imread, it’s just an alias for matplotlib.image.imread.

Answered By: duckboycool
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.