PyCharm: Show .png in markdown cell in Jupyter notebook file

Viewed 649

I am using PyCharm 2019.2 Professional and I am trying to figure out how to display a .png file within a markdown cell. My file is located in a subfolder called screenshots.

I tried the following line of code; however, PyCharm will not display the image. I just see an empty rectangle.

![test.png](screenshots/test.png]
1 Answers

After 4 short years, JetBrains finally fixed this issue in PyCharm 2021.3 EAP. The patch will not be ported to 2021.2 or earlier versions. See this thread.

If you're using an older PyCharm version and don't feel like updating right now, here is a dirty hack to print images on a grid in your notebook in PyCharm using matplotlib:

import matplotlib.pyplot as plt
f, ax = plt.subplots(1, 3)
ax[0].imshow(plt.imread('iguanas1.png'))
ax[1].imshow(plt.imread('iguanas2.png'))
ax[2].imshow(plt.imread('iguanas3.png'))
Related