Code
//not a perfect solution, but as far as I could get.
PImage img;
void setup() {
img = loadImage("sunset.jpg");
size(img.width, img.height*2);
println (size());
}
void draw() {
image(img, 0, 0);
image(img, 0, img.height);
colorMode (HSB);
for(int x=0; x<width; x++) {
for(int y=0; y<img.height; y++) {
int brightVal = 43;
float b = brightness(get(x,y));
//what is a bird?
if (b < brightVal){
noStroke();
colorMode(RGB);
color white = color (255,255,255);
//set(x, y, white);
int rh =9;
int rw = 11;
for (int j=(0-(rh/2)); j<(rh); j++){
for(int i=(0-(rw/2)); i<(rw); i++){
set (x+i, y+j, white);
}
}
/*
for (int i=0; i<=5; i++){
set(x+i, y, white);
set(x-i, y, white);
set(x, y+i, white);
set(x, y-i, white);
set(x+i, y+i, white);
set(x-i, y-i, white);
set(x-i, y+i, white);
set(x+i, y-i, white);
}
*/
}
}
}
colorMode(RGB);
for(int x=0; x<width; x++) {
for(int y=0; y<height; y++) {
color c = get(x,y);
if (red(c)==255 && green(c)==255 && blue(c)==255){
color prev = get (x-2,y);
set (x,y,prev);
}
}
}
}
041 -- Pixels I: Pest Control: Due 10/20
Statement:This sunset is pretty. But it has a problem. There are birds in the way. Write a program to remove the birds.
hide statement