/* * A filter to convert to sepia tone. */ // Or can load an image from a URL PImage slu = loadImage("http://business.slu.edu/uploads/2012/11/08/slu-homepage-campus4.jpg"); int w = slu.width; int h = slu.height; for (int x=0; x < w; x++) { for (int y=0; y < h; y++) { color c = slu.get(x,y); float newRed = 0.393 * red(c) + 0.769 * green(c) + 0.189 * blue(c); float newGreen = 0.349 * red(c) + 0.686 * green(c) + 0.168 * blue(c); float newBlue = 0.272 * red(c) + 0.534 * green(c) + 0.131 * blue(c); color replace = color(min(newRed,255), min(newGreen,255), min(newBlue,255)); slu.set(x,y,replace); } } // time to display it size(w,h); image(slu,0,0);