PImage img = loadImage("robotmarko-g.jpg"); size(680, 460); loadPixels(); img.loadPixels(); int x0 = 40; int y0 = 30; for (int y = 0; y < img.height; y++) for (int x = 0; x < img.width; x++) { int imgIndex = x + y * img.width; float r = brightness(img.pixels[imgIndex]); int displayIndex = (x + x0) + (y + y0) * width; pixels[displayIndex] = color(r); } updatePixels();