Display an image with Python

前端 未结 9 1642
后悔当初
后悔当初 2020-12-23 00:21

I tried to use IPython.display with the following code:

from IPython.display import display, Image
display(Image(filename=\'MyImage.png\'))

9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-23 01:00

    If you use matplotlib, you need to show the image using plt.show() unless you are not in interactive mode. E.g.:

    plt.figure()
    plt.imshow(sample_image) 
    plt.show()  # display it
    

提交回复
热议问题