PImage img; PFont font; void setup() { size(600, 400); img = loadImage("robotmarko-g.jpg"); loadPixels(); img.loadPixels(); font = createFont("Arial", 16, true); textFont(font, 22); fill(0); } void draw() { 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]); pixels[imgIndex] = color(r); } updatePixels(); int ind = mouseX + mouseY * width; float r = brightness(pixels[ind]); if (mouseX < width / 2) textAlign(LEFT); else textAlign(RIGHT); text(int(r), mouseX, mouseY + ((mouseY < 22) ? 22: 0)); }