Create a java.awt.image.BufferedImage with the same dimensions as your image. Paint your image on the BufferedImage. Use BufferedImage.getRGB() to get the pixels.
// although ImageIO.read pretends to returns an Image, in practice this is always a BufferedImage, so you can
// cast it to BufferedImage if you like...
Image image = ImageIO.read(new File("myFile.tga"));
int color = myBufferedImage.getRGB(x,y);
// red, green, blue in the range 0-255
int red = (color >> 16) & 0xFF;
int green = (color >> 8) & 0xFF;
int blue = color & 0xFF;
BufferedImage image = ImageIO.read(new File(“pic.jpg”));
That works, but it only takes JPG and GIF files… is there something else to load TGA/BMP files?
Annd how do you convert RGB vaules back into the single RGB int (so the reverse)?