Hello, i am still having problems getting RGB values at a specific coordinate of an image. This is the code i have so far, but for some reason all the values that it obtains are equal to zero.
//Gets Size
ImageIcon icon =new ImageIcon (filename);
int height = icon.getIconHeight();
int width = icon.getIconWidth();
Image image = Toolkit.getDefaultToolkit().getImage("C://image.gif");
BufferedImage bufIm = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics g = bufIm.getGraphics();
g.drawImage(image, 0, 0, null);
ColorModel cModel = bufIm.getColorModel();
colorInt = bufIm.getRGB(some width, some height);
int Red = cModel.getRed(colorInt);
int Green = cModel.getGreen(colorInt);
int Blue = cModel.getBlue(colorInt);
I think that the problem is that bufIm is never filled with the image but remains blank which is why R, G, and B values all read as zero, but i am not sure how to fix it. Any help would be greatly appreciated. Thanks.