List of utility methods to do RGB Color Convert To
double[] | rgbToXyz(int r, int g, int b) rgb To Xyz double[] rgb = scaleValues(0, 255, r, g, b); double red = rgb[0]; double green = rgb[1]; double blue = rgb[2]; double _red = (red > 0.04045f) ? Math.pow((red + 0.055f) / (1.0f + 0.055f), 2.4f) : (red / 12.92f); double _green = (green > 0.04045f) ? Math.pow((green + 0.055f) / (1.0f + 0.055f), 2.4f) : (green / 12.92f); double _blue = (blue > 0.04045f) ? Math.pow((blue + 0.055f) / (1.0f + 0.055f), 2.4f) : (blue / 12.92f); double X = _red * 0.649926f + _green * 0.103455f + _blue * 0.197109f; ... |
int | rgbToY(int rgb) rgb To Y int r = (rgb >> 16) & 0xff; int g = (rgb >> 8) & 0xff; int b = (rgb) & 0xff; return (int) (16 + 0.2568 * r + 0.5052 * g + 0.0979 * b); |