Another from the Knopf list




And- because you asked, here it how it's done:

PImage img;
PImage img2;

// Size of each cell in the grid
int cellSize = 15;
// Number of columns and rows in our system
int cols, rows;
// Variable for capture device


void setup() {
size(370, 550, P2D);
//frameRate(30);
cols = width / cellSize;
rows = height / cellSize;
colorMode(RGB, 255, 255, 255, 100);
smooth();

// load an image

img = loadImage("skull.jpg");
img2 = loadImage("peanut.jpg");
img2.resize(8, 0);
background(0);
}


void draw() {
loadPixels();

// Not bothering to clear background
// background(0);

// Begin loop for columns
for (int i = 0; i < cols; i++) {
// Begin loop for rows
for (int j = 0; j < rows; j++) {

// Where are we, pixel-wise?
int x = i*cellSize;
int y = j*cellSize;
int loc = (img.width - x - 1) + y*img.width; // Reversing x to mirror the image

float r = red(img.pixels[loc]);
float g = green(img.pixels[loc]);
float b = blue(img.pixels[loc]);
// Make a new color with an alpha component
color c = color(r, g, b, 15);

// Code for drawing a single rect
// Using translate in order for rotation to work properly
pushMatrix();
translate(x+cellSize/2, y+cellSize/2);
// Rotation formula based on brightness
//rotate((2 * PI * brightness(c) / 255.0));
rectMode(CENTER);
//fill(c);
noStroke();
// Rects are larger than the cell for some overlap
//rect(0, 0, cellSize+6, cellSize+6);
//rect(0, 0, 10, 30);
//triangle(0, 0, -15, 15, 15, 15);
tint(c);
image(img2, 0, 0);
popMatrix();
}
}
}


void mousePressed()
{
save("nutted.tif");
.......

Joe Monty has an Album



Joe Montgomery
is more than just great book jackets


.....