How to get the color value of an image, not that of what's drawn on the background

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?

In theory when imgBackground is your image say color colFromBackgroundImage = imgBackground.get(mouseX,mouseY) to get the color of that pixel

I think there is brightness() command

OR you receive red green blue values, add them (and divide by 3?)? Never tried that.

There is also hue and saturation, dunno, maybe to do with HSB?

Warm regards,

Chrisir