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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

PROCESSING: CREATIVE CODING AND COMPUTATIONAL ART<br />

458<br />

Figure 10-40. POSTERIZE Filter sketch<br />

The POSTERIZE argument converts the number of colors per each of the RGB components<br />

to a new level based on a required second-level argument. This argument must be in the<br />

range 2 to 255. As of this writing, the POSTERIZE option is not fully stable. While testing the<br />

function, I got numerous color values out of range, especially when I utilized a level argument<br />

that didn’t factor into 256. Hopefully this issue will be resolved by the time you’re<br />

reading this.<br />

// BLUR Filter<br />

// filter(BLUR, int radius);<br />

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

size(1000, 200);<br />

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

int cols = 5;<br />

int w = width/cols;<br />

int h = height;<br />

// cumulative blur<br />

for (int i=0; i

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

Saved successfully!

Ooh no, something went wrong!