I have an BufferedImage
transformed to grayscale using this code. I usually got the pixel values by BufferedImage.getRGB(i,j)
and the gor each value for R, G, and B. But how do I get the value of a pixel in a grayscale image?
EDIT: sorry, forgot abou the conversion.
static BufferedImage toGray(BufferedImage origPic) {
BufferedImage pic = new BufferedImage(origPic.getWidth(), origPic.getHeight(), BufferedImage.TYPE_BYTE_GRAY);
Graphics g = pic.getGraphics();
g.drawImage(origPic, 0, 0, null);
g.dispose();
return pic;
}