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

后端 未结 15 1095
天命终不由人
天命终不由人 2020-11-30 16:12

I would like to include image in a jupyter notebook.

If I did the following, it works :

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


        
15条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-30 16:39

    In addition to the other answers using HTML (either in Markdown or using the %%HTML magic:

    If you need to specify the image height, this will not work:

     <-- will not work
    

    That is because the CSS styling in Jupyter uses height: auto per default for the img tags, which overrides the HTML height attribute. You need need to overwrite the CSS height attribute instead:

     <-- works
    

提交回复
热议问题