size(617, 400);
noStroke();
background(0);
PImage img = loadImage("bajaros.jpg");
img.loadPixels();
int eachW = width / img.width;
int eachH = height / img.height;
int each = min(eachW, eachH);
int stripeW = each / 3;
each = 4* stripeW;
int left = (width - (img.width * each)) / 2;
int top = (height - (img.height * each)) / 2;
for (int y = 0; y < img.height; y++) {
int y1 = top + y*each;
for (int x = 0; x < img.width; x++) {
int pixel = img.get(x, y);
int x1 = left + x*each;
fill(red(pixel), 0, 0);
rect(x1 + stripeW*0, y1, stripeW, each);
fill(0, green(pixel), 0);
rect(x1 + stripeW*1, y1, stripeW, each);
fill(0, 0, blue(pixel));
rect(x1 + stripeW*2, y1, stripeW, each);
}
}
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario