# image.get\_pixel

**URL:** <https://forums.openmv.io/t/image-get-pixel/392>\
**Category:** OpenMV Boards\
**Created:** [August 25, 2017, 8:00pm UTC](https://forums.openmv.io/t/image-get-pixel/392 "2017-08-25T20:00:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pcls1026](https://avatars.discourse-cdn.com/v4/letter/p/57b2e6/32.png) [@pcls1026](https://forums.openmv.io/u/pcls1026)\
**Post date:** [August 25, 2017, 8:00pm UTC](https://forums.openmv.io/t/image-get-pixel/392/1 "2017-08-25T20:00:32Z")

</div>

Hello,  
I want to “print” the gray scale magnitude for pixel (7,9) to the serial terminal. The line “gs=—” returns a syntax error.  
My code below does not work.

```python
import sensor, image, time

sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to GRAYSCALE.
sensor.set_framesize(sensor.VGA) # Set frame size to QVGA (640x480)
sensor.skip_frames(time = 2000) # Wait for settings take effect.

img = sensor.snapshot() # Take a picture and return the image.
gs = in img.(image.get_pixel(7,9)) # Read pixel value of returned image.
print(gs) # print pixel value to the serial terminal

```

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [August 25, 2017, 8:33pm UTC](https://forums.openmv.io/t/image-get-pixel/392/2 "2017-08-25T20:33:38Z")

</div>

You just need to to do:

```python
print(img.get_pixel(7, 9))

```

Please use the code tags when posting code to improve readability.

---

<div class="post-metadata">

**Author:** ![pcls1026](https://avatars.discourse-cdn.com/v4/letter/p/57b2e6/32.png) [@pcls1026](https://forums.openmv.io/u/pcls1026)\
**Post date:** [August 28, 2017, 11:35pm UTC](https://forums.openmv.io/t/image-get-pixel/392/3 "2017-08-28T23:35:02Z")

</div>

What is a “code Tag” ?

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [August 28, 2017, 11:37pm UTC](https://forums.openmv.io/t/image-get-pixel/392/4 "2017-08-28T23:37:09Z")

</div>

There’s a button that says “code” when you are submitting replies here. You click that to insert code tags into the reply which will keep any code you post formatted.
