Resize the image in jupyter notebook using markdown

假如想象 提交于 2019-12-17 22:38:31

问题


I want to add the image in the Jupyter notebook and I want to have particular height and width. When I try to add the image using

![](img.png)

the code is adding the complete image but as per the image dimension and I don't have control over it. I try to use ![](img.png =200x100) but then the image does not appear.

Does anybody know of a way to add an image with pre-specified dimensions?


回答1:


You can use html directly

<img src="image.JPG" alt="Drawing" style="width: 200px;"/>



回答2:


Image control in Jupyter markdown is possible but the image needs to be preceded by "attachment" or it doesn't display.

<img src="attachment:image.png" width="400">

Cf. Simon Byrne.

With a url it works directly:

<img src=https://image.slidesharecdn.com/tensorflowppt-160408142819/95/tensorflow-4-638.jpg?cb=1460125744 width="500">



回答3:


If you're attaching your images by inserting them into the markdown like this:

![Screenshot.png](attachment:Screenshot.png)

These attachment links don't work:

<img src="attachment:Screenshot.png" width="500"/>

DO THIS. This does work. Just add div brackets:

<div>
<img src="attachment:Screenshot.png" width="500"/>
</div>

Hope this helps!

PS I'm using jupyter_core-4.4.0 & jupyter notebook.




回答4:


You need to use HTML as Mark showed you, since you cannot do it with ![](img.png) syntax. From John Gruber's website:

As of this writing, Markdown has no syntax for specifying the dimensions of an image; if this is important to you, you can simply use regular HTML tags.



来源:https://stackoverflow.com/questions/41598916/resize-the-image-in-jupyter-notebook-using-markdown

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!