title: Java BufferedImage get single pixel brightness
body: <p>I want to convert coloured image to a monochrome, i thought to loop all pixel, but I don't know how to test if they are bright or dark.</p>
  
  <pre><code>        for(int y=0;y&lt;image.getHeight();y++){
              for(int x=0;x&lt;image.getWidth();x++){
                  int color=image.getRGB(x, y);
                  // ???how to test if its is bright or dark?
              }
          }
  </code></pre>