# Read Pixel Color in Processing

**URL:** <https://spout.discourse.group/t/read-pixel-color-in-processing/378>\
**Category:** Support\
**Created:** [February 15, 2022, 6:29pm UTC](https://spout.discourse.group/t/read-pixel-color-in-processing/378 "2022-02-15T18:29:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![npuckett](https://avatars.discourse-cdn.com/v4/letter/n/45deac/32.png) [@npuckett](https://spout.discourse.group/u/npuckett)\
**Post date:** [February 15, 2022, 6:29pm UTC](https://spout.discourse.group/t/read-pixel-color-in-processing/378/1 "2022-02-15T18:29:43Z")

</div>

I have a video stream coming into processing and I need to be able to read the colors of all the pixels in the stream. I have tried reading it as both a PImage and PGraphic, but the normal methods of loadPixels(), or even get() don’t seem to work, It only reads back 0’s. I was looking through the source and it does seem to use a Texture variable, but I still can’t manage to read the colors.

It displays fine, but I need to be able to scan/read the pixel array.

---

<div class="post-metadata">

**Author:** ![spout](https://avatars.discourse-cdn.com/v4/letter/s/ac91a4/32.png) [@spout](https://spout.discourse.group/u/spout)\
**Post date:** [February 19, 2022, 7:06am UTC](https://spout.discourse.group/t/read-pixel-color-in-processing/378/2 "2022-02-19T07:06:25Z")

</div>

Hi @npuckett

sorry for the delay in response. I have been out of action for a week or so.

The reason for your trouble is that the Spout functions only update the texture of PImage or PGraphics. Pixel update has to be added to the library.

Until then you should be able to get the image pixels from a received PGraphics texture. I have made a possible solution for you to try [here](https://github.com/leadedge/leadedge.github.io/blob/downloads/SpoutReceiver_PImage-from-PGraphic.zip).

---

<div class="post-metadata">

**Author:** ![npuckett](https://avatars.discourse-cdn.com/v4/letter/n/45deac/32.png) [@npuckett](https://spout.discourse.group/u/npuckett)\
**Post date:** [February 20, 2022, 4:21pm UTC](https://spout.discourse.group/t/read-pixel-color-in-processing/378/3 "2022-02-20T16:21:13Z")

</div>

This is perfect. Thanks for your help. I was writing it into a normal PGraphic instead of PGraphicOPENGL, so I couldn’t get the data out. You might consider adding this as an example for the processing library in the next release. I’m pretty familiar with processing and couldn’t get this to work and it is extremely useful.

Thanks again for taking the time.

---

<div class="post-metadata">

**Author:** ![spout](https://avatars.discourse-cdn.com/v4/letter/s/ac91a4/32.png) [@spout](https://spout.discourse.group/u/spout)\
**Post date:** [February 21, 2022, 12:01am UTC](https://spout.discourse.group/t/read-pixel-color-in-processing/378/4 "2022-02-21T00:01:51Z")

</div>

Ok, it’s good that you have a solution.

The code additions really belong in the library but could be in an example as you say. The library is due for an update soon, so I will look into options.
