/* * Demonstration of a vignette through masking. */ int bands = 255; float outerSize = 1.2; // size of outer ellipse, as percentage of full float innerSize = 0.6; // size of inner ellipse, as percentage of full size(408, 300); // original image is 408x300 PImage slu = loadImage("http://business.slu.edu/uploads/2012/11/08/slu-homepage-campus4.jpg"); int w = slu.width; int h = slu.height; // create the mask image PGraphics mask = createGraphics(w, h); mask.noSmooth(); mask.beginDraw(); mask.background(0); mask.noStroke(); for (int j=0; j < bands; j++) { mask.fill( map(j, 0, bands-1, 0, 255) ); // gradiant shading float scale = map(j, 0, bands-1, outerSize, innerSize); mask.ellipse(0.5*w, 0.5*h, scale*w, scale*h); } mask.endDraw(); // apply the mask to the original image slu.mask(mask); // draw masked image over a black background background(0); image(slu, 0, 0);