How to check if the response from get is the same as color?

int x=1;
int y=1;
import java.awt.Robot;
import java.awt.image.BufferedImage;
import java.awt.Rectangle;
color pas = color(11, 96, 133); //this is the color

Robot robot;
void setup() {
  size(1500, 3000);
  try {
    robot = new Robot();
  catch (Exception e) {
void draw() {
  Rectangle r = new Rectangle(mouseX, mouseY, width, height);
  BufferedImage img1 = robot.createScreenCapture(r);
  PImage img2 = new PImage(img1);
  image(img2, 0, 0);
  get(x,y); //this is the get

Hi @MoonAlien822 ,

When you post a question on the forum, can you give more details about what you are actually trying to do ? (rather than putting the question in the title)

What doesn’t work with your current code? What’s the end goal?

It would help us answer your questions! :wink:



Our community guidelines ask that you:

Don’t cross-post the same thing in multiple topics.

Community Guidelines:

You have related posts here:

Make this to:

color colorFromGet = get(x,y);  // store in a variable

if ( colorFromGet  == pas ) // compare
     println("Same");  // Hooray! 

thanks. what does the


It is the response that prints to the console that answers your question of whether “get” is the same value as “color”.
On the flip side, if it is not equal in value then nothing prints in the console.

1 Like


There are lots of resources (tutorials, references, examples, etc.) here:

Check out the examples that come with Processing.
These are in the menu under File > Examples…> :


Other resources:

I encourage you to peruse the resource’s available to you on the Processing website and the examples in the Processing app.

I go through these often and learning something new each time.

It will get easier.


follow up question here: How to play a sound when if ( colorFromGet == pas )?

1 Like