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.

In the last example, I used <strong>Processing</strong>’s r<strong>and</strong>om() function to vary the size of the source<br />

segments. Notice that when the segments were very small they became highly pixilated<br />

when blown up in the destination image.<br />

The other blend modes work similarly to SUBTRACT; just substitute a different mode for<br />

SUBTRACT in the blend() call in the last example to see the difference.<br />

Saving a file<br />

Here’s one last blend() example (shown in Figure 10-49) using the LIGHTEST mode. I<br />

structured this sketch using the PImage blend() method form <strong>and</strong> reversed the order of<br />

the two images. I also threw in <strong>Processing</strong>’s cool save() function.<br />

/* PImage blend() Method LIGHTEST Mode<br />

--R<strong>and</strong>om Source Coodinates & save() */<br />

size(300, 400);<br />

PImage img1 = loadImage("towers.jpg");<br />

PImage img2 = loadImage("airport.jpg");<br />

int w = width/24;<br />

int h = height/32;<br />

for (int i=0; i

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

Saved successfully!

Ooh no, something went wrong!