PImage photo;
int curplace;
int numpixels;
int xpos;
int ypos;
void setup(){
photo=loadImage(“source.jpg”);
size(photo.width,photo.height);
numpixels=photo.width*photo.height;
println(numpixels);
}
void draw(){
//image(photo,0,0);
random(numpixels);
curplace=int(random(numpixels));
for(int lop=0; lop<100; lop++){
curplace=int(random(numpixels));
color thiscol = photo.pixels[curplace];
fill(red(thiscol),green(thiscol),blue(thiscol),60
stroke(red(thiscol),green(thiscol),blue(thiscol),60);
ypos=curplace/photo.width; //gives how many rows in the image before the current line that we are on
xpos=curplace-(ypos*photo.width);
// rect(random(photo.width),random(photo.height),10,10);
rect(xpos,ypos,10,10);
}
}
);