04.04.2013 Views

Processing: Creative Coding and Computational Art

Processing: Creative Coding and Computational Art

Processing: Creative Coding and Computational Art

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Figure 10-39. GRAY Filter sketch<br />

The GRAY filter argument should be pretty self-explanatory—colored images are converted<br />

to grayscale. There are no additional optional arguments.<br />

// POSTERIZE Filter<br />

// filter(POSTERIZE, int colorLevels);<br />

// image should be 200 x 200 pixels<br />

size(1000, 200);<br />

background(255);<br />

PImage img = loadImage("moonshadow.jpg");<br />

int cols = 5;<br />

int w = width/cols;<br />

int h = height;<br />

int[]vals = {2, 4, 8, 16, 32};<br />

for (int i=0; i

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!