Html 使用降价调整 jupyter notebook 中的图像大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41598916/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Resize the image in jupyter notebook using markdown
提问by Anil Verma
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
我想在 Jupyter 笔记本中添加图像,并且我想要具有特定的高度和宽度。当我尝试使用添加图像时


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 but then the image does not appear.
代码正在添加完整的图像,但根据图像尺寸,我无法控制它。我尝试使用但是图像没有出现。
Does anybody know of a way to add an image with pre-specified dimensions?
有人知道添加具有预先指定尺寸的图像的方法吗?
回答by Mark
You can use html directly
可以直接使用html
<img src="image.JPG" alt="Drawing" style="width: 200px;"/>
回答by pudepied
Image control in Jupyter markdown is possible but the image needs to be preceded by "attachment" or it doesn't display.
Jupyter Markdown 中的图像控制是可能的,但图像需要在“附件”之前加上,否则它不会显示。
<img src="attachment:image.png" width="400">
With a url it works directly:
使用 url 它可以直接工作:
<img src=https://image.slidesharecdn.com/tensorflowppt-160408142819/95/tensorflow-4-638.jpg?cb=1460125744 width="500">
回答by MrFun
If you're attaching your images by inserting them into the markdown like this:
如果您通过将图像插入降价来附加图像,如下所示:

These attachment
links don'twork:
这些attachment
链接不工作:
<img src="attachment:Screenshot.png" width="500"/>
DO THIS. This doeswork. Just add div brackets:
这样做。这确实有效。只需添加 div 括号:
<div>
<img src="attachment:Screenshot.png" width="500"/>
</div>
Hope this helps!
希望这可以帮助!
PS I'm using jupyter_core-4.4.0
& jupyter notebook.
PS我正在使用jupyter_core-4.4.0
jupyter 笔记本。
回答by Llewlyn
You need to use HTML as Mark showed you, since you cannot do it with 
syntax. From John Gruber's website:
您需要使用 Mark 向您展示的 HTML,因为您无法使用
语法来做到这一点。从约翰格鲁伯的网站:
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.
在撰写本文时,Markdown 没有用于指定图像尺寸的语法;如果这对您很重要,您可以简单地使用常规 HTML 标签。