How to embed image or picture in jupyter notebook, either from a local machine or from a web resource?

532    Asked by DipikaAgarwal in Data Science , Asked on Jul 12, 2021

I would like to include an image in a Jupyter notebook.

If I did the following, it works :

from IPython.display import Image 
Image("img/picture.png")

But I would like to include the images in a markdown cell and the following code gives a 404 error :

![title]("img/picture.png")

I also tried

![texte]("http://localhost:8888/img/picture.png")

But I still get the same error :

404 GET /notebooks/"/home/user/folder/img/picture.png" (127.0.0.1) 2.74ms referer=http://localhost:8888/notebooks/notebook.ipyn
Answered by John Durso

You mustn't use quotation marks to insert an image in a Jupyter notebook around the name of the image files in markdown!

If you carefully read your error message, you will see the two " parts in the link. That is the HTML encoded quotation mark.

You have to change the line

    ![title]("img/picture.png")

to

    ![title](img/picture.png)


Your Answer

Interviews

Parent Categories