Java RGB Color Convert To RgbToGray(int r, int g, int b)

Here you can find the source of RgbToGray(int r, int g, int b)

Description

Rgb To Gray

License

Open Source License

Declaration

public static int RgbToGray(int r, int g, int b) 

Method Source Code

//package com.java2s;
/*/* ww w  .j av  a  2 s  . com*/
 * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
 * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 */

public class Main {
    public static int RgbToGray(int r, int g, int b) {
        return (int) (r * .3 + g * .59 + b * .11);
    }

    public static int RgbToGray(int xrgb) {
        return RgbToGray((xrgb >> 16) & 0xff, (xrgb >> 8) & 0xff, (xrgb) & 0xff);
    }
}

Related

  1. rgbToBlackWhite(int pix, int threshold)
  2. rgbToColor(int r, int g, int b)
  3. rgbToDecimal(int r, int g, int b)
  4. rgbToGray(int colorIn)
  5. rgbToGray(int pixels)
  6. rgbToGrey(byte[] rgb)
  7. rgbToHex(final int r, final int g, final int b)
  8. rgbToHex(int r, int g, int b)
  9. RGBtoHex(int r, int g, int b)