Java examples for 2D Graphics:BufferedImage Color
get Red from BufferedImage
//package com.java2s; import java.awt.image.BufferedImage; public class Main { public static int getRed(BufferedImage i, int x, int y) { return ((i.getRGB(x, y) >> 16) & 255); }//from ww w. j a v a 2 s. c o m public static int[] getRGB(BufferedImage i, int x, int y) { int rgb = i.getRGB(x, y); int[] res = new int[3]; res[0] = (rgb >> 16) & 255; res[1] = (rgb >> 8) & 255; res[2] = (rgb) & 255; return res; } }