Search code examples
javargbbufferedimage

Java - Red, Green, Blue to getRGB


By calling getRGB(int x, int y) with a BufferedImage object, one gets a single, negative number.

How can I convert three different values (a red, a green, and a blue) into this single, negative number?


Solution

  • Using the Color class:

    new Color(r, g, b).getRGB()