can not render images in ipynb files on vscode

Question:

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 🙂

Asked By: Mr.Gogo

||

Answers:

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

Unfortunately there is no workaround.

Answered By: R Chiodo

seems they have fixed it

#%%[markdown]
# ![title](sample_image.png)
Answered By: SsOo
%matplotlib inline
from IPython.display import Image
Image('image_path')
Answered By: Ivan Dobryaev

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)

Answered By: sonification

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 have 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)

Answered By: Elias

<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
Answered By: sicheng mao
 ![Tux, the Linux mascot](./assets/images/tux.png)
 # ![title](./assets/images/tux.png)

Work with me

Answered By: Giang Minh