Mr.Gogo
Mr.Gogo

Reputation: 313

can not render images in ipynb files on vscode

i have installed vscode with official microsoft python package , every thing is ok except images rendering in markdown

i tried the following codes for displaying images in markdown cell :

<img src="images/grad_summary.png" style="width:600px;height:300px;">

alt

![title](images/grad_summary.png)

but it is not working although it is working on jupyter notebook

P.S.

vscode version: 1.40.1

python version : 3.7

vscode python extension version : 2019.10.44104

os : windows 10

Any Help :)

Upvotes: 12

Views: 28215

Answers (7)

Elias
Elias

Reputation: 811

First you can drag a picture from VS Code file explorer and then dropping it in a Markdown cell holding shift button.

If you still having problems displaying the image, try to delete everything written in the file link except the picture's name. In your case you would have something like this:

![title](grad_summary.png)

Upvotes: 1

Giang Minh
Giang Minh

Reputation: 1

 ![Tux, the Linux mascot](./assets/images/tux.png)
 # ![title](./assets/images/tux.png)

Work with me

Upvotes: 0

sicheng mao
sicheng mao

Reputation: 85

<img src="images/grad_summary.png"> works for me now

vscode info

Version: 1.74.3 (user setup)
Commit: 97dec172d3256f8ca4bfb2143f3f76b503ca0534
Date: 2023-01-09T16:59:02.252Z
Electron: 19.1.8
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Windows_NT x64 10.0.19044
Sandboxed: No
Jupyter extension: v2022.11.1003412109

Upvotes: 0

sonification
sonification

Reputation: 1

As of 31/05/2022, If you initially create the file in Jupyter Notebook and later open it in VC Code, the code for embedding the picture is:

![picTitle](attachment:ch01_05.jpg)

Just delete 'attachment:' (to express the reference in the right format)

 ![picTitle](ch01_05.jpg)

and the picture will load. (given the reference/path to it is still valid)

Upvotes: 0

Ivan Dobryaev
Ivan Dobryaev

Reputation: 170

%matplotlib inline
from IPython.display import Image
Image('image_path')

Upvotes: 8

SsOo
SsOo

Reputation: 104

seems they have fixed it

#%%[markdown]
# ![title](sample_image.png)

Upvotes: 8

R Chiodo
R Chiodo

Reputation: 554

This is a known issue with local paths to images: https://github.com/microsoft/vscode-python/issues/7704

Unfortunately there is no workaround.

Upvotes: 1

Related Questions