# Numpy image display

**URL:** <https://forum.opencv.org/t/numpy-image-display/3583>\
**Category:** Python\
**Created:** [May 29, 2021, 2:23pm UTC](https://forum.opencv.org/t/numpy-image-display/3583 "2021-05-29T14:23:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/mike/32/4250_2.png) [@mike](https://forum.opencv.org/u/mike)\
**Post date:** [May 29, 2021, 2:23pm UTC](https://forum.opencv.org/t/numpy-image-display/3583/1 "2021-05-29T14:23:05Z")

</div>

Hey, everyone! I am trying to display the numpy image via matplotlib.pyplot, but the code had just completed successfully and the image had not been displayed. Here is the code:

```auto
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
im = Image.open(path to my image)
pic = np.asarray(im)
plt.imshow(pic)

```

I wonder if anyone helps…

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [May 29, 2021, 5:33pm UTC](https://forum.opencv.org/t/numpy-image-display/3583/2 "2021-05-29T17:33:09Z")

</div>

this is not using opencv, so - off-topic

---

<div class="post-metadata">

**Author:** ![furas](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/furas/32/706_2.png) [@furas](https://forum.opencv.org/u/furas)\
**Post date:** [June 3, 2021, 2:49pm UTC](https://forum.opencv.org/t/numpy-image-display/3583/3 "2021-06-03T14:49:12Z")

</div>

Add

```
plt.show()

```

at the end.

* * *

Full code - tested on Linux Mint 20

```auto
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image

im = Image.open('test/lenna.png')
pic = np.asarray(im)
plt.imshow(pic)
plt.show()

```

 ![Zrzut ekranu z 2021-06-03 16-52-20](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/7/7d82729200fca8028adc008f016e95efbcfda117.png)

Image `lenna.png` from Wikipedia: [lenna](https://en.wikipedia.org/wiki/Lenna)

---

<div class="post-metadata">

**Author:** ![laurent.berger](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@laurent.berger](https://forum.opencv.org/u/laurent.berger)\
**Post date:** [June 3, 2021, 4:03pm UTC](https://forum.opencv.org/t/numpy-image-display/3583/4 "2021-06-03T16:03:17Z")

</div>

> [@berak](#):
>
> this is not using opencv, so - off-topic

agree : completely off topic  
matplotlib tutorials are [here](https://matplotlib.org/stable/tutorials/introductory/images.html#sphx-glr-tutorials-introductory-images-py)

---

<div class="post-metadata">

**Author:** ![mike](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/mike/32/4250_2.png) [@mike](https://forum.opencv.org/u/mike)\
**Post date:** [June 4, 2021, 4:10pm UTC](https://forum.opencv.org/t/numpy-image-display/3583/5 "2021-06-04T16:10:20Z")

</div>

Thank you so much!!!
