// This program shows how to you can access pixels // and separate out the rgb values. You can then // modify these rgb values if desired. // The original image PImage orig; orig = loadImage("tree.png"); size(orig.width, orig.height); loadPixels(); for (int i = 0; i < height*width; i++) { // The functions red(), green(), and blue() pull out the 3 color components from a pixel. // The values of r,g,b are in the range 0 to 255 float r = red(orig.pixels[i]); float g = green(orig.pixels[i]); float b = blue(orig.pixels[i]); pixels[i] = color(r, g, b); } updatePixels();