In this example, (no image, I’ve just used a background colour to demonstrate) the background colour value is 25 but when there’s a brush that overlays the background, mouseX and mouseY returns the value of what’s drawn the surface, not the image (background).
How to get the colour value of an image itself even when there’s something drawn onto it?
void setup() {
size(800, 600);
frameRate(60);
}
void draw() {
background(25);
noStroke();
fill(255, mouseX);
ellipse(mouseX, mouseY, 30, 30);
color c = get(mouseX, mouseY);
float shade;
shade = int(blue(c));
print(shade);
}
By the way, I’m using the blue© to get the grey scale value because the image I’m going to use is black and white, is there any other way to get the b&w value without using r, g or b?