
Creating a pixelation effect with Processing is relatively easy. Just like the effect achieved with nested loops of circles, a similar effect can be created by generating a nested loop of squares and then passing the color property to each of the generated squares. In this case, we pixelate an image featuring the work of Mexican muralist Chávez Morado.
PImage source;
int area = 25;
void setup() {
size(630, 320);
source = loadImage("josé_chávez_morado.jpg");
noStroke();
for (int y = 0; y < source.height; y += area) {
for (int x = 0; x < source.width; x += area) {
color pixelColor = source.get(x, y);
fill(pixelColor);
rect(x, y, area, area);
}
}
}
