// This code loads an image, then displays it. When the 't' // key is pressed, the image on the screen is transformed in // the way you define. When the 'u' key is pressed, the image // goes back to the original image. PImage verasImg; float scaling; void setup() { // load the image out of memory and display it to the screen verasImg = loadImage("IMG_6225.JPG"); //scale to fit window scaling = 500.0 / verasImg.height; size(400, 400); } void draw() { if (keyPressed) { if (key == 'u') { image(verasImg, 0, 0, verasImg.width *scaling, verasImg.height * scaling); } else if (key == 't') { loadPixels(); for (int i = 0; i < pixels.length; i++) { pixels[i] = transform(i); } updatePixels(); } } } // Some ideas of what 'transform' could do: // Add noise to the pixel // Rotate the pixel's red, green, and blue components // Color invert the pixel // Increase hue, saturation, or brightness by some fixed value // or some percentage // Average with the previous or next pixel's values (watch out for when // you are at the edge of the image!)