Java RGB Color Convert To rgbToGray(int pixels)

Here you can find the source of rgbToGray(int pixels)

Description

rgb To Gray

License

Apache License

Declaration

public static int rgbToGray(int pixels) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {

    public static int rgbToGray(int pixels) {
        // int _alpha = (pixels >> 24) & 0xFF;
        int _red = (pixels >> 16) & 0xFF;
        int _green = (pixels >> 8) & 0xFF;
        int _blue = (pixels) & 0xFF;
        return (int) (0.3 * _red + 0.59 * _green + 0.11 * _blue);
    }/*from   w ww  .ja va 2 s .  c o  m*/
}

Related

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