# Basic example of creating an image doesn't work

**URL:** <https://forum.opencv.org/t/basic-example-of-creating-an-image-doesnt-work/14361>\
**Category:** Python\
**Tags:** programming\
**Created:** [August 26, 2023, 1:32pm UTC](https://forum.opencv.org/t/basic-example-of-creating-an-image-doesnt-work/14361 "2023-08-26T13:32:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasonbb](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@jasonbb](https://forum.opencv.org/u/jasonbb)\
**Post date:** [August 26, 2023, 1:32pm UTC](https://forum.opencv.org/t/basic-example-of-creating-an-image-doesnt-work/14361/1 "2023-08-26T13:32:05Z")

</div>

I can’t get my App to draw an image.  
The code I found here:  
#[OpenCV: Drawing Functions in OpenCV](https://docs.opencv.org/4.x/dc/da5/tutorial_py_drawing_functions.html)

import numpy as np  
import cv2 as cv  
img = np.zeros((512,512,3), np.uint8)  
cv.line(img,(0,0),(511,511),(255,0,0),5)

I guess this code should draw an image but it does nothing.

---

<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:** [August 26, 2023, 2:37pm UTC](https://forum.opencv.org/t/basic-example-of-creating-an-image-doesnt-work/14361/2 "2023-08-26T14:37:06Z")

</div>

> [@jasonbb](#):
>
> but it does nothing.

it correctly draws a line into an existing image.

if you expected to see a window showing your image  
– your code does not do that.

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [August 26, 2023, 3:53pm UTC](https://forum.opencv.org/t/basic-example-of-creating-an-image-doesnt-work/14361/3 "2023-08-26T15:53:40Z")

</div>

You must have skipped the preceding two tutorials.

OpenCV is a library for people who are _experienced programmers_.

Please seek out a forum for beginners. We don’t have the capacity to help people learn how to program.

Perhaps you would like to learn about “PyGame”.

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [August 26, 2023, 3:53pm UTC](https://forum.opencv.org/t/basic-example-of-creating-an-image-doesnt-work/14361/4 "2023-08-26T15:53:44Z")

</div>


