Issue
I tried to use IPython.display with the following code:
from IPython.display import display, Image
display(Image(filename='MyImage.png'))
I also tried to use matplotlib with the following code:
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
plt.imshow(mpimg.imread('MyImage.png'))
In both cases, nothing is displayed, not even an error message.
Solution
If you are using matplotlib and want to show the image in your interactive notebook, try the following:
%pylab inline
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
img = mpimg.imread('your_image.png')
imgplot = plt.imshow(img)
plt.show()
Answered By - Joe Bathelt
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.