/* * Create a left-to-right flip of the original image. Although we could * exchange pixel values in place, we take the easier approach of * creating a second image. */ PImage slu, reversed; int w,h; void setup() { size(408,300); // take advantage of our knowledge of the size // Can either load an image stored locally, as follows: // slu = loadImage("campus4.jpg"); // Or can load an image from a URL as follows: slu = loadImage("http://business.slu.edu/uploads/2012/11/08/slu-homepage-campus4.jpg"); w = slu.width; h = slu.height; reversed = createImage(w,h,RGB); for (int x=0; x < w; x++) { for (int y=0; y < h; y++) { reversed.set(x, y, slu.get(w-1-x,y)); } } // time to display it image(reversed, 0, 0); }