# Pixels and images

**URL:** <https://discourse.processing.org/t/pixels-and-images/19558>\
**Category:** Coding Questions\
**Created:** [April 8, 2020, 9:18pm UTC](https://discourse.processing.org/t/pixels-and-images/19558 "2020-04-08T21:18:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eduwu](https://avatars.discourse-cdn.com/v4/letter/e/cc9497/32.png) [@Eduwu](https://discourse.processing.org/u/Eduwu)\
**Post date:** [April 8, 2020, 9:18pm UTC](https://discourse.processing.org/t/pixels-and-images/19558/1 "2020-04-08T21:18:11Z")

</div>

HI! I’m a beginner in processing and I’m trying to do a sketch with an image with a noise filter using pixel, but I don’t know exactly what to do.  
this is my code right now, but I want the image to have the original color and the noise but with the image still visible.

```auto
PImage ed;

float g,b,r;

void setup(){
 size(600,600); 
 ed = loadImage("ed.jpg");
 ed.resize(width,height);
}
void draw(){
  image(ed,0,0);
  loadPixels();
  
    for(int x=0;x<width;x++){
      for(int y=0;y<height;y++){
    int loc = x+y*width;
   r=random(255);
   g = green(ed.pixels[loc]);
   b=random(255);
   pixels[loc]=color(g,b,r);
      }
    }
   
  updatePixels();
}

```

thanks!

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [April 16, 2020, 3:17pm UTC](https://discourse.processing.org/t/pixels-and-images/19558/2 "2020-04-16T15:17:24Z")

</div>

> [@Eduwu](#):
>
> the original color and the noise but with the image still visible.

Were you able to resolve this?

Do you mean that you want to change the color of each pixel in a random way, just a bit?

> [@Eduwu](#):
>
> r=random(255); g = green(ed.pixels[loc]); b=random(255); pixels[loc]=color(g,b,r);

This gives you a total different (random) R and B channel. That’s pretty loud noise! You might want something where you get the RGB values (like you currently get G) and then add a small random amount to them. `random(-32, 32)` would shift the value up to 12% in either direction…
