How can I display an image from a file in Jupyter Notebook? How can I display an image from a file in Jupyter Notebook? python python

How can I display an image from a file in Jupyter Notebook?


Courtesy of this post, you can do the following:

from IPython.display import ImageImage(filename='test.png') 

(official docs)


If you are trying to display an Image in this way inside a loop, then you need to wrap the Image constructor in a display method.

from IPython.display import Image, displaylistOfImageNames = ['/path/to/images/1.png',                    '/path/to/images/2.png']for imageName in listOfImageNames:    display(Image(filename=imageName))


Note, until now posted solutions only work for png and jpg!

If you want it even easier without importing further libraries or you want to display an animated or not animated GIF File in your Ipython Notebook. Transform the line where you want to display it to markdown and use this nice short hack!

![alt text](test.gif "Title")